1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
6
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
7
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
8
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\ApiProperty; |
|
|
|
|
12
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
13
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter; |
|
|
|
|
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
16
|
|
|
use ControleOnline\Filter\CustomOrFilter; |
17
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
18
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
19
|
|
|
use Symfony\Component\Validator\Constraints as Assert; |
|
|
|
|
20
|
|
|
|
21
|
|
|
/** |
22
|
|
|
* @ORM\EntityListeners ({ControleOnline\Listener\LogListener::class}) |
23
|
|
|
* @ORM\Table (name="category") |
24
|
|
|
* @ORM\Entity (repositoryClass="ControleOnline\Repository\CategoryRepository") |
25
|
|
|
*/ |
26
|
|
|
#[ApiResource( |
27
|
|
|
operations: [ |
28
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
29
|
|
|
new Put( |
30
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
31
|
|
|
denormalizationContext: ['groups' => ['translate_write']] |
32
|
|
|
), |
33
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
34
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
35
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
36
|
|
|
], |
37
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
38
|
|
|
normalizationContext: ['groups' => ['translate_read']], |
39
|
|
|
denormalizationContext: ['groups' => ['translate_write']] |
40
|
|
|
)] |
41
|
|
|
#[ApiFilter(filterClass: ExistsFilter::class, properties: ['parent'])] |
42
|
|
|
#[ApiFilter(filterClass: OrderFilter::class, properties: ['name' => 'ASC'])] |
43
|
|
|
#[ApiFilter(CustomOrFilter::class, properties: ['name', 'id', 'icon', 'color'])] |
44
|
|
|
|
45
|
|
|
class Translate |
46
|
|
|
{ |
47
|
|
|
/** |
48
|
|
|
* @var integer |
49
|
|
|
* |
50
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
51
|
|
|
* @ORM\Id |
52
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
53
|
|
|
* @Groups({"translate_read","translate_write"}) |
54
|
|
|
*/ |
55
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
56
|
|
|
|
57
|
|
|
private $id; |
58
|
|
|
|
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var \ControleOnline\Entity\People |
|
|
|
|
62
|
|
|
* |
63
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
64
|
|
|
* @ORM\JoinColumns({ |
65
|
|
|
* @ORM\JoinColumn(name="people_id", referencedColumnName="id") |
66
|
|
|
* }) |
67
|
|
|
* @Groups({"translate_read","translate_write"}) |
68
|
|
|
* @Assert\NotBlank |
69
|
|
|
*/ |
70
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['people' => 'exact'])] |
71
|
|
|
|
72
|
|
|
private $people; |
73
|
|
|
/** |
74
|
|
|
* @var string |
75
|
|
|
* |
76
|
|
|
* @ORM\Column(name="store", type="string", length=100, nullable=false) |
77
|
|
|
* @Groups({"translate_read","translate_write"}) |
78
|
|
|
* @Assert\NotBlank |
79
|
|
|
*/ |
80
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['store' => 'partial'])] |
81
|
|
|
|
82
|
|
|
private $store; |
83
|
|
|
|
84
|
|
|
|
85
|
|
|
/** |
86
|
|
|
* @var string |
87
|
|
|
* |
88
|
|
|
* @ORM\Column(name="type", type="string", length=100, nullable=false) |
89
|
|
|
* @Groups({"translate_read","translate_write"}) |
90
|
|
|
* @Assert\NotBlank |
91
|
|
|
*/ |
92
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'partial'])] |
93
|
|
|
|
94
|
|
|
private $type; |
95
|
|
|
|
96
|
|
|
/** |
97
|
|
|
* @var string |
98
|
|
|
* |
99
|
|
|
* @ORM\Column(name="translate_key", type="string", length=100, nullable=false) |
100
|
|
|
* @Groups({"translate_read","translate_write"}) |
101
|
|
|
* @Assert\NotBlank |
102
|
|
|
*/ |
103
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['translate_key' => 'partial'])] |
104
|
|
|
|
105
|
|
|
private $key; |
106
|
|
|
/** |
107
|
|
|
* @var string |
108
|
|
|
* |
109
|
|
|
* @ORM\Column(name="translate", type="string", length=100, nullable=false) |
110
|
|
|
* @Groups({"translate_read","translate_write"}) |
111
|
|
|
* @Assert\NotBlank |
112
|
|
|
*/ |
113
|
|
|
|
114
|
|
|
private $translate; |
115
|
|
|
|
116
|
|
|
|
117
|
|
|
/** |
118
|
|
|
* @var \ControleOnline\Entity\Language |
119
|
|
|
* |
120
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Language") |
121
|
|
|
* @ORM\JoinColumns({ |
122
|
|
|
* @ORM\JoinColumn(name="lang_id", referencedColumnName="id", nullable=true) |
123
|
|
|
* }) |
124
|
|
|
* @Assert\NotBlank |
125
|
|
|
* @Groups({"translate_read","translate_write"}) |
126
|
|
|
*/ |
127
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['language' => 'exact'])] |
128
|
|
|
|
129
|
|
|
private $language; |
130
|
|
|
|
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* Get the value of id |
134
|
|
|
*/ |
135
|
|
|
public function getId() |
136
|
|
|
{ |
137
|
|
|
return $this->id; |
138
|
|
|
} |
139
|
|
|
|
140
|
|
|
/** |
141
|
|
|
* Get the value of people |
142
|
|
|
*/ |
143
|
|
|
public function getPeople() |
144
|
|
|
{ |
145
|
|
|
return $this->people; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
/** |
149
|
|
|
* Set the value of people |
150
|
|
|
*/ |
151
|
|
|
public function setPeople($people): self |
152
|
|
|
{ |
153
|
|
|
$this->people = $people; |
154
|
|
|
|
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
/** |
159
|
|
|
* Get the value of store |
160
|
|
|
*/ |
161
|
|
|
public function getStore() |
162
|
|
|
{ |
163
|
|
|
return $this->store; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
/** |
167
|
|
|
* Set the value of store |
168
|
|
|
*/ |
169
|
|
|
public function setStore($store): self |
170
|
|
|
{ |
171
|
|
|
$this->store = $store; |
172
|
|
|
|
173
|
|
|
return $this; |
174
|
|
|
} |
175
|
|
|
|
176
|
|
|
/** |
177
|
|
|
* Get the value of type |
178
|
|
|
*/ |
179
|
|
|
public function getType() |
180
|
|
|
{ |
181
|
|
|
return $this->type; |
182
|
|
|
} |
183
|
|
|
|
184
|
|
|
/** |
185
|
|
|
* Set the value of type |
186
|
|
|
*/ |
187
|
|
|
public function setType($type): self |
188
|
|
|
{ |
189
|
|
|
$this->type = $type; |
190
|
|
|
|
191
|
|
|
return $this; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
/** |
195
|
|
|
* Get the value of key |
196
|
|
|
*/ |
197
|
|
|
public function getKey() |
198
|
|
|
{ |
199
|
|
|
return $this->key; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
/** |
203
|
|
|
* Set the value of key |
204
|
|
|
*/ |
205
|
|
|
public function setKey($key): self |
206
|
|
|
{ |
207
|
|
|
$this->key = $key; |
208
|
|
|
|
209
|
|
|
return $this; |
210
|
|
|
} |
211
|
|
|
|
212
|
|
|
/** |
213
|
|
|
* Get the value of translate |
214
|
|
|
*/ |
215
|
|
|
public function getTranslate() |
216
|
|
|
{ |
217
|
|
|
return $this->translate; |
218
|
|
|
} |
219
|
|
|
|
220
|
|
|
/** |
221
|
|
|
* Set the value of translate |
222
|
|
|
*/ |
223
|
|
|
public function setTranslate($translate): self |
224
|
|
|
{ |
225
|
|
|
$this->translate = $translate; |
226
|
|
|
|
227
|
|
|
return $this; |
228
|
|
|
} |
229
|
|
|
|
230
|
|
|
/** |
231
|
|
|
* Get the value of language |
232
|
|
|
*/ |
233
|
|
|
public function getLanguage() |
234
|
|
|
{ |
235
|
|
|
return $this->language; |
236
|
|
|
} |
237
|
|
|
|
238
|
|
|
/** |
239
|
|
|
* Set the value of language |
240
|
|
|
*/ |
241
|
|
|
public function setLanguage($language): self |
242
|
|
|
{ |
243
|
|
|
$this->language = $language; |
244
|
|
|
|
245
|
|
|
return $this; |
246
|
|
|
} |
247
|
|
|
} |
248
|
|
|
|
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