1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
15
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
16
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
17
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
18
|
|
|
use App\Filter\OrderEntityFilter; |
|
|
|
|
19
|
|
|
use ControleOnline\Entity\Order; |
|
|
|
|
20
|
|
|
use stdClass; |
21
|
|
|
|
22
|
|
|
|
23
|
|
|
/** |
24
|
|
|
* Routes |
25
|
|
|
* |
26
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
27
|
|
|
* @ORM\Table(name="routes", uniqueConstraints={@ORM\UniqueConstraint(name="route", columns={"route"})}, indexes={@ORM\Index(name="module_id", columns={"module_id"})}) |
28
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\RouteRepository") |
29
|
|
|
* @ORM\Entity |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
#[ApiResource( |
33
|
|
|
operations: [ |
34
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'), |
35
|
|
|
new Put( |
36
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
37
|
|
|
denormalizationContext: ['groups' => ['route_write']] |
38
|
|
|
), |
39
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
40
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_CLIENT\')'), |
41
|
|
|
new Post(security: 'is_granted(\'ROLE_CLIENT\')'), |
42
|
|
|
], |
43
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
44
|
|
|
normalizationContext: ['groups' => ['route_read']], |
45
|
|
|
denormalizationContext: ['groups' => ['route_write']] |
46
|
|
|
)] |
47
|
|
|
|
48
|
|
|
class Routes |
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","route_read"}) |
57
|
|
|
*/ |
58
|
|
|
private $id; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(name="route", type="string", length=50, nullable=false) |
64
|
|
|
* @Groups({"menu_read","route_read","route_write"}) |
65
|
|
|
*/ |
66
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['route' => 'exact'])] |
67
|
|
|
|
68
|
|
|
private $route; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @var \Module |
|
|
|
|
72
|
|
|
* |
73
|
|
|
* @ORM\ManyToOne(targetEntity="Module") |
74
|
|
|
* @ORM\JoinColumns({ |
75
|
|
|
* @ORM\JoinColumn(name="module_id", referencedColumnName="id") |
76
|
|
|
* }) |
77
|
|
|
* @Groups({"menu_read","route_read","route_write"}) |
78
|
|
|
*/ |
79
|
|
|
private $module; |
80
|
|
|
/** |
81
|
|
|
* @var string |
82
|
|
|
* |
83
|
|
|
* @ORM\Column(name="color", type="string", length=50, nullable=false, options={"default"="'$primary'"}) |
84
|
|
|
* @Groups({"menu_read","route_read","route_write"}) |
85
|
|
|
*/ |
86
|
|
|
private $color = '$primary'; |
87
|
|
|
/** |
88
|
|
|
* @var string |
89
|
|
|
* |
90
|
|
|
* @ORM\Column(name="icon", type="string", length=50, nullable=false) |
91
|
|
|
* @Groups({"menu_read","route_read","route_write"}) |
92
|
|
|
*/ |
93
|
|
|
private $icon; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* Get the value of id |
97
|
|
|
*/ |
98
|
|
|
public function getId() |
99
|
|
|
{ |
100
|
|
|
return $this->id; |
101
|
|
|
} |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* Set the value of id |
105
|
|
|
*/ |
106
|
|
|
public function setId(int $id): self |
107
|
|
|
{ |
108
|
|
|
$this->id = $id; |
109
|
|
|
|
110
|
|
|
return $this; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
/** |
114
|
|
|
* Get the value of route |
115
|
|
|
*/ |
116
|
|
|
public function getRoute() |
117
|
|
|
{ |
118
|
|
|
return $this->route; |
119
|
|
|
} |
120
|
|
|
|
121
|
|
|
/** |
122
|
|
|
* Set the value of route |
123
|
|
|
*/ |
124
|
|
|
public function setRoute($route): self |
125
|
|
|
{ |
126
|
|
|
$this->route = $route; |
127
|
|
|
|
128
|
|
|
return $this; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
/** |
132
|
|
|
* Get the value of module |
133
|
|
|
*/ |
134
|
|
|
public function getModule() |
135
|
|
|
{ |
136
|
|
|
return $this->module; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
/** |
140
|
|
|
* Set the value of module |
141
|
|
|
*/ |
142
|
|
|
public function setModule($module): self |
143
|
|
|
{ |
144
|
|
|
$this->module = $module; |
145
|
|
|
|
146
|
|
|
return $this; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
/** |
150
|
|
|
* Get the value of color |
151
|
|
|
*/ |
152
|
|
|
public function getColor(): string |
153
|
|
|
{ |
154
|
|
|
return $this->color; |
155
|
|
|
} |
156
|
|
|
/** |
157
|
|
|
* Set the value of color |
158
|
|
|
*/ |
159
|
|
|
public function setColor($color): self |
160
|
|
|
{ |
161
|
|
|
$this->color = $color; |
162
|
|
|
return $this; |
163
|
|
|
} |
164
|
|
|
/** |
165
|
|
|
* Get the value of icon |
166
|
|
|
*/ |
167
|
|
|
public function getIcon(): string |
168
|
|
|
{ |
169
|
|
|
return $this->icon; |
170
|
|
|
} |
171
|
|
|
/** |
172
|
|
|
* Set the value of icon |
173
|
|
|
*/ |
174
|
|
|
public function setIcon($icon): self |
175
|
|
|
{ |
176
|
|
|
$this->icon = $icon; |
177
|
|
|
return $this; |
178
|
|
|
} |
179
|
|
|
} |
180
|
|
|
|
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