1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
6
|
|
|
use ControleOnline\Entity\People; |
|
|
|
|
7
|
|
|
use ControleOnline\Entity\ProductUnity; |
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
15
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
16
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
17
|
|
|
use Doctrine\Common\Collections\Collection; |
|
|
|
|
18
|
|
|
|
19
|
|
|
/** |
20
|
|
|
* Product |
21
|
|
|
* |
22
|
|
|
* @ORM\Table(name="product", uniqueConstraints={@ORM\UniqueConstraint(name="company_id", columns={"company_id", "sku"})}, indexes={@ORM\Index(name="product_unit_id", columns={"product_unit_id"}), @ORM\Index(name="IDX_D34A04AD979B1AD6", columns={"company_id"})}) |
23
|
|
|
* @ORM\Entity(repositoryClass="ControleOnline\Repository\ProductRepository") |
24
|
|
|
*/ |
25
|
|
|
|
26
|
|
|
#[ApiResource( |
27
|
|
|
operations: [ |
28
|
|
|
new Get( |
29
|
|
|
security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')', |
30
|
|
|
normalizationContext: ['groups' => ['product_details:read']], |
31
|
|
|
), |
32
|
|
|
new Put( |
33
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
34
|
|
|
denormalizationContext: ['groups' => ['product:write']] |
35
|
|
|
), |
36
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
37
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
38
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
39
|
|
|
], |
40
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
41
|
|
|
normalizationContext: ['groups' => ['product:read']], |
42
|
|
|
denormalizationContext: ['groups' => ['product:write']] |
43
|
|
|
)] |
44
|
|
|
|
45
|
|
|
|
46
|
|
|
class Product |
47
|
|
|
{ |
48
|
|
|
/** |
49
|
|
|
* @var int |
50
|
|
|
* |
51
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
52
|
|
|
* @ORM\Id |
53
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
54
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","order_product:read"}) |
55
|
|
|
*/ |
56
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
57
|
|
|
|
58
|
|
|
private $id; |
59
|
|
|
|
60
|
|
|
/** |
61
|
|
|
* @var string |
62
|
|
|
* |
63
|
|
|
* @ORM\Column(name="product", type="string", length=255, nullable=false) |
64
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
65
|
|
|
*/ |
66
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'partial'])] |
67
|
|
|
|
68
|
|
|
private $product; |
69
|
|
|
|
70
|
|
|
/** |
71
|
|
|
* @ORM\OneToMany(targetEntity="ProductFile", mappedBy="product") |
72
|
|
|
* @Groups({"product_details:read"}) |
73
|
|
|
*/ |
74
|
|
|
private $productFiles; |
75
|
|
|
|
76
|
|
|
/** |
77
|
|
|
* @var string|null |
78
|
|
|
* |
79
|
|
|
* @ORM\Column(name="sku", type="string", length=32, nullable=true, options={"default"="NULL"}) |
80
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
81
|
|
|
*/ |
82
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'partial'])] |
83
|
|
|
|
84
|
|
|
private $sku = NULL; |
85
|
|
|
|
86
|
|
|
/** |
87
|
|
|
* @var string |
88
|
|
|
* |
89
|
|
|
* @ORM\Column(name="type", type="string", length=0, nullable=false, options={"default"="'product'"}) |
90
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
91
|
|
|
*/ |
92
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])] |
93
|
|
|
private $type = 'product'; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var float |
97
|
|
|
* |
98
|
|
|
* @ORM\Column(name="price", type="float", precision=10, scale=0, nullable=false) |
99
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
100
|
|
|
*/ |
101
|
|
|
private $price = 0; |
102
|
|
|
|
103
|
|
|
/** |
104
|
|
|
* @var string |
105
|
|
|
* |
106
|
|
|
* @ORM\Column(name="product_condition", type="string", length=0, nullable=false, options={"default"="'new'"}) |
107
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
108
|
|
|
*/ |
109
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])] |
110
|
|
|
|
111
|
|
|
private $productCondition = 'new'; |
112
|
|
|
|
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @var string |
116
|
|
|
* |
117
|
|
|
* @ORM\Column(name="description", type="string", length=0, nullable=false) |
118
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
119
|
|
|
*/ |
120
|
|
|
private $description = ''; |
121
|
|
|
|
122
|
|
|
/** |
123
|
|
|
* @var bool |
124
|
|
|
* |
125
|
|
|
* @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"}) |
126
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
127
|
|
|
*/ |
128
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])] |
129
|
|
|
|
130
|
|
|
private $active = true; |
131
|
|
|
|
132
|
|
|
/** |
133
|
|
|
* @var \ControleOnline\Entity\People |
134
|
|
|
* |
135
|
|
|
* @ORM\ManyToOne(targetEntity="\ControleOnline\Entity\People") |
136
|
|
|
* @ORM\JoinColumns({ |
137
|
|
|
* @ORM\JoinColumn(name="company_id", referencedColumnName="id") |
138
|
|
|
* }) |
139
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
140
|
|
|
*/ |
141
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])] |
142
|
|
|
|
143
|
|
|
private $company; |
144
|
|
|
|
145
|
|
|
/** |
146
|
|
|
* @var ProductUnity |
147
|
|
|
* |
148
|
|
|
* @ORM\ManyToOne(targetEntity="ProductUnity") |
149
|
|
|
* @ORM\JoinColumns({ |
150
|
|
|
* @ORM\JoinColumn(name="product_unit_id", referencedColumnName="id") |
151
|
|
|
* }) |
152
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
153
|
|
|
*/ |
154
|
|
|
private $productUnit; |
155
|
|
|
|
156
|
|
|
/** |
157
|
|
|
* @var Queue |
|
|
|
|
158
|
|
|
* |
159
|
|
|
* @ORM\ManyToOne(targetEntity="Queue") |
160
|
|
|
* @ORM\JoinColumns({ |
161
|
|
|
* @ORM\JoinColumn(name="queue_id", referencedColumnName="id") |
162
|
|
|
* }) |
163
|
|
|
* @Groups({"product_category:read","product:read","product_details:read","product_group_product:read","order_product:read","order_product_queue:read","order:read","order_details:read","order:write","product:write"}) |
164
|
|
|
*/ |
165
|
|
|
private $queue; |
166
|
|
|
|
167
|
|
|
public function __construct() |
168
|
|
|
{ |
169
|
|
|
$this->productFiles = new \Doctrine\Common\Collections\ArrayCollection(); |
|
|
|
|
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
/** |
173
|
|
|
* Get the value of id |
174
|
|
|
*/ |
175
|
|
|
public function getId(): int |
176
|
|
|
{ |
177
|
|
|
return $this->id; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
/** |
181
|
|
|
* Set the value of id |
182
|
|
|
*/ |
183
|
|
|
public function setId(int $id): self |
184
|
|
|
{ |
185
|
|
|
$this->id = $id; |
186
|
|
|
|
187
|
|
|
return $this; |
188
|
|
|
} |
189
|
|
|
|
190
|
|
|
/** |
191
|
|
|
* Get the value of product |
192
|
|
|
*/ |
193
|
|
|
public function getProduct(): string |
194
|
|
|
{ |
195
|
|
|
return $this->product; |
196
|
|
|
} |
197
|
|
|
|
198
|
|
|
/** |
199
|
|
|
* Set the value of product |
200
|
|
|
*/ |
201
|
|
|
public function setProduct(string $product): self |
202
|
|
|
{ |
203
|
|
|
$this->product = $product; |
204
|
|
|
|
205
|
|
|
return $this; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
/** |
209
|
|
|
* Get the value of sku |
210
|
|
|
*/ |
211
|
|
|
public function getSku(): ?string |
212
|
|
|
{ |
213
|
|
|
return $this->sku; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
/** |
217
|
|
|
* Set the value of sku |
218
|
|
|
*/ |
219
|
|
|
public function setSku(?string $sku): self |
220
|
|
|
{ |
221
|
|
|
$this->sku = $sku; |
222
|
|
|
|
223
|
|
|
return $this; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
/** |
227
|
|
|
* Get the value of type |
228
|
|
|
*/ |
229
|
|
|
public function getType(): string |
230
|
|
|
{ |
231
|
|
|
return $this->type; |
232
|
|
|
} |
233
|
|
|
|
234
|
|
|
/** |
235
|
|
|
* Set the value of type |
236
|
|
|
*/ |
237
|
|
|
public function setType(string $type): self |
238
|
|
|
{ |
239
|
|
|
$this->type = $type; |
240
|
|
|
|
241
|
|
|
return $this; |
242
|
|
|
} |
243
|
|
|
|
244
|
|
|
/** |
245
|
|
|
* Get the value of price |
246
|
|
|
*/ |
247
|
|
|
public function getPrice(): float |
248
|
|
|
{ |
249
|
|
|
return $this->price; |
250
|
|
|
} |
251
|
|
|
|
252
|
|
|
/** |
253
|
|
|
* Set the value of price |
254
|
|
|
*/ |
255
|
|
|
public function setPrice(float $price): self |
256
|
|
|
{ |
257
|
|
|
$this->price = $price; |
258
|
|
|
|
259
|
|
|
return $this; |
260
|
|
|
} |
261
|
|
|
|
262
|
|
|
/** |
263
|
|
|
* Get the value of productCondition |
264
|
|
|
*/ |
265
|
|
|
public function getProductCondition(): string |
266
|
|
|
{ |
267
|
|
|
return $this->productCondition; |
268
|
|
|
} |
269
|
|
|
|
270
|
|
|
/** |
271
|
|
|
* Set the value of productCondition |
272
|
|
|
*/ |
273
|
|
|
public function setProductCondition(string $productCondition): self |
274
|
|
|
{ |
275
|
|
|
$this->productCondition = $productCondition; |
276
|
|
|
|
277
|
|
|
return $this; |
278
|
|
|
} |
279
|
|
|
|
280
|
|
|
/** |
281
|
|
|
* Get the value of active |
282
|
|
|
*/ |
283
|
|
|
public function isActive(): bool |
284
|
|
|
{ |
285
|
|
|
return $this->active; |
286
|
|
|
} |
287
|
|
|
|
288
|
|
|
/** |
289
|
|
|
* Set the value of active |
290
|
|
|
*/ |
291
|
|
|
public function setActive(bool $active): self |
292
|
|
|
{ |
293
|
|
|
$this->active = $active; |
294
|
|
|
|
295
|
|
|
return $this; |
296
|
|
|
} |
297
|
|
|
|
298
|
|
|
/** |
299
|
|
|
* Get the value of company |
300
|
|
|
*/ |
301
|
|
|
public function getCompany(): ?People |
302
|
|
|
{ |
303
|
|
|
return $this->company; |
304
|
|
|
} |
305
|
|
|
|
306
|
|
|
/** |
307
|
|
|
* Set the value of company |
308
|
|
|
*/ |
309
|
|
|
public function setCompany(People $company): self |
310
|
|
|
{ |
311
|
|
|
$this->company = $company; |
312
|
|
|
|
313
|
|
|
return $this; |
314
|
|
|
} |
315
|
|
|
|
316
|
|
|
/** |
317
|
|
|
* Get the value of productUnit |
318
|
|
|
*/ |
319
|
|
|
public function getProductUnit(): ProductUnity |
320
|
|
|
{ |
321
|
|
|
return $this->productUnit; |
322
|
|
|
} |
323
|
|
|
|
324
|
|
|
/** |
325
|
|
|
* Set the value of productUnit |
326
|
|
|
*/ |
327
|
|
|
public function setProductUnit(ProductUnity $productUnit): self |
328
|
|
|
{ |
329
|
|
|
$this->productUnit = $productUnit; |
330
|
|
|
|
331
|
|
|
return $this; |
332
|
|
|
} |
333
|
|
|
|
334
|
|
|
public function getActive(): ?bool |
335
|
|
|
{ |
336
|
|
|
return $this->active; |
337
|
|
|
} |
338
|
|
|
|
339
|
|
|
/** |
340
|
|
|
* Get the value of description |
341
|
|
|
*/ |
342
|
|
|
public function getDescription() |
343
|
|
|
{ |
344
|
|
|
return $this->description; |
345
|
|
|
} |
346
|
|
|
|
347
|
|
|
/** |
348
|
|
|
* Set the value of description |
349
|
|
|
*/ |
350
|
|
|
public function setDescription($description): self |
351
|
|
|
{ |
352
|
|
|
$this->description = $description; |
353
|
|
|
|
354
|
|
|
return $this; |
355
|
|
|
} |
356
|
|
|
|
357
|
|
|
/** |
358
|
|
|
* Get the value of queue |
359
|
|
|
*/ |
360
|
|
|
public function getQueue() |
361
|
|
|
{ |
362
|
|
|
return $this->queue; |
363
|
|
|
} |
364
|
|
|
|
365
|
|
|
/** |
366
|
|
|
* Set the value of queue |
367
|
|
|
*/ |
368
|
|
|
public function setQueue($queue): self |
369
|
|
|
{ |
370
|
|
|
$this->queue = $queue; |
371
|
|
|
|
372
|
|
|
return $this; |
373
|
|
|
} |
374
|
|
|
|
375
|
|
|
/** |
376
|
|
|
* @return Collection|ProductFile[] |
377
|
|
|
*/ |
378
|
|
|
public function getProductFiles(): Collection |
379
|
|
|
{ |
380
|
|
|
return $this->productFiles; |
381
|
|
|
} |
382
|
|
|
} |
383
|
|
|
|
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