|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
|
|
11
|
|
|
use ControleOnline\Controller\GetActionByPeopleAction; |
|
12
|
|
|
use ControleOnline\Controller\GetMenuByPeopleAction; |
|
13
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
14
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
|
|
15
|
|
|
|
|
16
|
|
|
|
|
17
|
|
|
/** |
|
18
|
|
|
* Menu |
|
19
|
|
|
* |
|
20
|
|
|
* @ORM\EntityListeners ({App\Listener\LogListener::class}) |
|
21
|
|
|
* @ORM\Table (name="menu", uniqueConstraints={@ORM\UniqueConstraint (name="route", columns={"route"})}, indexes={ @ORM\Index(name="category_id", columns={"category_id"})}) |
|
22
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\MenuRepository") |
|
23
|
|
|
* @ORM\Entity |
|
24
|
|
|
*/ |
|
25
|
|
|
#[ApiResource( |
|
26
|
|
|
operations: [ |
|
27
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'), |
|
28
|
|
|
new Put( |
|
29
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
|
30
|
|
|
denormalizationContext: ['groups' => ['menu_write']] |
|
31
|
|
|
), |
|
32
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
|
33
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
|
34
|
|
|
new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
|
35
|
|
|
new GetCollection( |
|
36
|
|
|
uriTemplate: '/menus-people', |
|
37
|
|
|
controller: GetMenuByPeopleAction::class |
|
38
|
|
|
), |
|
39
|
|
|
new GetCollection( |
|
40
|
|
|
uriTemplate: '/actions/people', |
|
41
|
|
|
controller: GetActionByPeopleAction::class |
|
42
|
|
|
) |
|
43
|
|
|
], |
|
44
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
45
|
|
|
normalizationContext: ['groups' => ['menu_read']], |
|
46
|
|
|
denormalizationContext: ['groups' => ['menu_write']] |
|
47
|
|
|
)] |
|
48
|
|
|
class Menu |
|
49
|
|
|
{ |
|
50
|
|
|
/** |
|
51
|
|
|
* @var int |
|
52
|
|
|
* |
|
53
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
|
54
|
|
|
* @ORM\Id |
|
55
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
|
56
|
|
|
* @Groups({"menu_read"}) |
|
57
|
|
|
*/ |
|
58
|
|
|
private $id; |
|
59
|
|
|
/** |
|
60
|
|
|
* @var string |
|
61
|
|
|
* |
|
62
|
|
|
* @ORM\Column(name="menu", type="string", length=50, nullable=false) |
|
63
|
|
|
* @Groups({"menu_read","menu_write"}) |
|
64
|
|
|
*/ |
|
65
|
|
|
private $menu; |
|
66
|
|
|
/** |
|
67
|
|
|
* @var \Route |
|
|
|
|
|
|
68
|
|
|
* |
|
69
|
|
|
* @ORM\ManyToOne(targetEntity="Routes") |
|
70
|
|
|
* @ORM\JoinColumns({ |
|
71
|
|
|
* @ORM\JoinColumn(name="route_id", referencedColumnName="id") |
|
72
|
|
|
* }) |
|
73
|
|
|
* @Groups({"menu_read","menu_write"}) |
|
74
|
|
|
*/ |
|
75
|
|
|
private $route; |
|
76
|
|
|
/** |
|
77
|
|
|
* @var string |
|
78
|
|
|
* |
|
79
|
|
|
* @ORM\Column(name="color", type="string", length=50, nullable=false, options={"default"="'$primary'"}) |
|
80
|
|
|
* @Groups({"menu_read"}) |
|
81
|
|
|
*/ |
|
82
|
|
|
private $color = '$primary'; |
|
83
|
|
|
/** |
|
84
|
|
|
* @var string |
|
85
|
|
|
* |
|
86
|
|
|
* @ORM\Column(name="icon", type="string", length=50, nullable=false) |
|
87
|
|
|
* @Groups({"menu_read","menu_write"}) |
|
88
|
|
|
*/ |
|
89
|
|
|
private $icon; |
|
90
|
|
|
|
|
91
|
|
|
/** |
|
92
|
|
|
* @var \ControleOnline\Entity\Category |
|
93
|
|
|
* |
|
94
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Category") |
|
95
|
|
|
* @ORM\JoinColumns({ |
|
96
|
|
|
* @ORM\JoinColumn(name="category_id", referencedColumnName="id") |
|
97
|
|
|
* }) |
|
98
|
|
|
* @Groups({"menu_read","menu_write"}) |
|
99
|
|
|
*/ |
|
100
|
|
|
private $category; |
|
101
|
|
|
/** |
|
102
|
|
|
* Get the value of id |
|
103
|
|
|
*/ |
|
104
|
|
|
public function getId(): int |
|
105
|
|
|
{ |
|
106
|
|
|
return $this->id; |
|
107
|
|
|
} |
|
108
|
|
|
/** |
|
109
|
|
|
* Get the value of menu |
|
110
|
|
|
*/ |
|
111
|
|
|
public function getMenu(): string |
|
112
|
|
|
{ |
|
113
|
|
|
return $this->menu; |
|
114
|
|
|
} |
|
115
|
|
|
/** |
|
116
|
|
|
* Set the value of menu |
|
117
|
|
|
*/ |
|
118
|
|
|
public function setMenu($menu): self |
|
119
|
|
|
{ |
|
120
|
|
|
$this->menu = $menu; |
|
121
|
|
|
return $this; |
|
122
|
|
|
} |
|
123
|
|
|
/** |
|
124
|
|
|
* Get the value of route |
|
125
|
|
|
*/ |
|
126
|
|
|
public function getRoute() |
|
127
|
|
|
{ |
|
128
|
|
|
return $this->route; |
|
129
|
|
|
} |
|
130
|
|
|
/** |
|
131
|
|
|
* Set the value of route |
|
132
|
|
|
*/ |
|
133
|
|
|
public function setRoute($route): self |
|
134
|
|
|
{ |
|
135
|
|
|
$this->route = $route; |
|
136
|
|
|
return $this; |
|
137
|
|
|
} |
|
138
|
|
|
/** |
|
139
|
|
|
* Get the value of color |
|
140
|
|
|
*/ |
|
141
|
|
|
public function getColor(): string |
|
142
|
|
|
{ |
|
143
|
|
|
return $this->color; |
|
144
|
|
|
} |
|
145
|
|
|
/** |
|
146
|
|
|
* Set the value of color |
|
147
|
|
|
*/ |
|
148
|
|
|
public function setColor($color): self |
|
149
|
|
|
{ |
|
150
|
|
|
$this->color = $color; |
|
151
|
|
|
return $this; |
|
152
|
|
|
} |
|
153
|
|
|
/** |
|
154
|
|
|
* Get the value of icon |
|
155
|
|
|
*/ |
|
156
|
|
|
public function getIcon(): string |
|
157
|
|
|
{ |
|
158
|
|
|
return $this->icon; |
|
159
|
|
|
} |
|
160
|
|
|
/** |
|
161
|
|
|
* Set the value of icon |
|
162
|
|
|
*/ |
|
163
|
|
|
public function setIcon($icon): self |
|
164
|
|
|
{ |
|
165
|
|
|
$this->icon = $icon; |
|
166
|
|
|
return $this; |
|
167
|
|
|
} |
|
168
|
|
|
|
|
169
|
|
|
/** |
|
170
|
|
|
* Get the value of category |
|
171
|
|
|
*/ |
|
172
|
|
|
public function getCategory() |
|
173
|
|
|
{ |
|
174
|
|
|
return $this->category; |
|
175
|
|
|
} |
|
176
|
|
|
/** |
|
177
|
|
|
* Set the value of category |
|
178
|
|
|
*/ |
|
179
|
|
|
public function setCategory($category): self |
|
180
|
|
|
{ |
|
181
|
|
|
$this->category = $category; |
|
182
|
|
|
return $this; |
|
183
|
|
|
} |
|
184
|
|
|
} |
|
185
|
|
|
|
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths