1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
6
|
|
|
use Doctrine\Common\Collections\ArrayCollection; |
|
|
|
|
7
|
|
|
use ApiPlatform\Core\Annotation\ApiSubresource; |
|
|
|
|
8
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
11
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
12
|
|
|
use stdClass; |
13
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\DateFilter; |
|
|
|
|
14
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\ExistsFilter; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
16
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
17
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
18
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
19
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
20
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
21
|
|
|
|
22
|
|
|
#[ApiResource( |
23
|
|
|
operations: [ |
24
|
|
|
new Get(security: 'is_granted(\'ROLE_CLIENT\')'), |
25
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
26
|
|
|
new Post(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
27
|
|
|
new Put(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'), |
28
|
|
|
new Delete(security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))'), |
29
|
|
|
], |
30
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
31
|
|
|
normalizationContext: ['groups' => ['order_product:read']], |
32
|
|
|
denormalizationContext: ['groups' => ['order_product:write']] |
33
|
|
|
)] |
34
|
|
|
#[ApiFilter(filterClass: OrderFilter::class, properties: ['alterDate' => 'DESC'])] |
35
|
|
|
#[ApiFilter(OrderFilter::class, properties: ['id' => 'ASC', 'product.product' => 'ASC'])] |
36
|
|
|
class OrderProduct |
37
|
|
|
{ |
38
|
|
|
/** |
39
|
|
|
* @ORM\Id |
40
|
|
|
* @ORM\GeneratedValue |
41
|
|
|
* @ORM\Column(type="integer") |
42
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
43
|
|
|
*/ |
44
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
45
|
|
|
private $id; |
46
|
|
|
|
47
|
|
|
/** |
48
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Order") |
49
|
|
|
* @ORM\JoinColumn(nullable=false) |
50
|
|
|
* @Groups({"order_product_queue:read","order_product:write","order_product:read"}) |
51
|
|
|
*/ |
52
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['order' => 'exact'])] |
53
|
|
|
private $order; |
54
|
|
|
|
55
|
|
|
/** |
56
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Product") |
57
|
|
|
* @ORM\JoinColumn(nullable=false) |
58
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
59
|
|
|
*/ |
60
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
61
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['product.type' => 'exact'])] |
62
|
|
|
private $product; |
63
|
|
|
|
64
|
|
|
/** |
65
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Queue") |
66
|
|
|
* @ORM\JoinColumn(nullable=true) |
67
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
68
|
|
|
*/ |
69
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['queue' => 'exact'])] |
70
|
|
|
private $queue; |
71
|
|
|
|
72
|
|
|
/** |
73
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Product") |
74
|
|
|
* @ORM\JoinColumn(nullable=true) |
75
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
76
|
|
|
*/ |
77
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['parentProduct'])] |
78
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['parentProduct' => 'exact'])] |
79
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['parentProduct.type' => 'exact'])] |
80
|
|
|
private $parentProduct; |
81
|
|
|
|
82
|
|
|
/** |
83
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\OrderProduct") |
84
|
|
|
* @ORM\JoinColumn(nullable=true) |
85
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
86
|
|
|
*/ |
87
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['orderProduct'])] |
88
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderProduct' => 'exact'])] |
89
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderProduct.type' => 'exact'])] |
90
|
|
|
private $orderProduct; |
91
|
|
|
|
92
|
|
|
/** |
93
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\ProductGroup") |
94
|
|
|
* @ORM\JoinColumn(nullable=true) |
95
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
96
|
|
|
*/ |
97
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['productGroup'])] |
98
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
99
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup.type' => 'exact'])] |
100
|
|
|
private $productGroup; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @ORM\Column(type="float") |
104
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
105
|
|
|
*/ |
106
|
|
|
private $quantity = 1; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @ORM\Column(type="float") |
110
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
111
|
|
|
*/ |
112
|
|
|
private $price = 0; |
113
|
|
|
|
114
|
|
|
/** |
115
|
|
|
* @ORM\Column(type="float") |
116
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
117
|
|
|
*/ |
118
|
|
|
private $total = 0; |
119
|
|
|
|
120
|
|
|
// Getters and setters |
121
|
|
|
|
122
|
|
|
public function getId() |
123
|
|
|
{ |
124
|
|
|
return $this->id; |
125
|
|
|
} |
126
|
|
|
|
127
|
|
|
public function setId($id): self |
128
|
|
|
{ |
129
|
|
|
$this->id = $id; |
130
|
|
|
return $this; |
131
|
|
|
} |
132
|
|
|
|
133
|
|
|
public function getOrder() |
134
|
|
|
{ |
135
|
|
|
return $this->order; |
136
|
|
|
} |
137
|
|
|
|
138
|
|
|
public function setOrder($order): self |
139
|
|
|
{ |
140
|
|
|
$this->order = $order; |
141
|
|
|
return $this; |
142
|
|
|
} |
143
|
|
|
|
144
|
|
|
public function getProduct() |
145
|
|
|
{ |
146
|
|
|
return $this->product; |
147
|
|
|
} |
148
|
|
|
|
149
|
|
|
public function setProduct($product): self |
150
|
|
|
{ |
151
|
|
|
$this->product = $product; |
152
|
|
|
return $this; |
153
|
|
|
} |
154
|
|
|
|
155
|
|
|
public function getQueue() |
156
|
|
|
{ |
157
|
|
|
return $this->queue; |
158
|
|
|
} |
159
|
|
|
|
160
|
|
|
public function setQueue($queue): self |
161
|
|
|
{ |
162
|
|
|
$this->queue = $queue; |
163
|
|
|
return $this; |
164
|
|
|
} |
165
|
|
|
|
166
|
|
|
public function getQuantity() |
167
|
|
|
{ |
168
|
|
|
return $this->quantity; |
169
|
|
|
} |
170
|
|
|
|
171
|
|
|
public function setQuantity($quantity): self |
172
|
|
|
{ |
173
|
|
|
$this->quantity = $quantity; |
174
|
|
|
return $this; |
175
|
|
|
} |
176
|
|
|
|
177
|
|
|
public function getPrice() |
178
|
|
|
{ |
179
|
|
|
return $this->price; |
180
|
|
|
} |
181
|
|
|
|
182
|
|
|
public function setPrice($price): self |
183
|
|
|
{ |
184
|
|
|
$this->price = $price; |
185
|
|
|
return $this; |
186
|
|
|
} |
187
|
|
|
|
188
|
|
|
public function getTotal() |
189
|
|
|
{ |
190
|
|
|
return $this->total; |
191
|
|
|
} |
192
|
|
|
|
193
|
|
|
public function setTotal($total): self |
194
|
|
|
{ |
195
|
|
|
$this->total = $total; |
196
|
|
|
return $this; |
197
|
|
|
} |
198
|
|
|
|
199
|
|
|
public function getParentProduct() |
200
|
|
|
{ |
201
|
|
|
return $this->parentProduct; |
202
|
|
|
} |
203
|
|
|
|
204
|
|
|
public function setParentProduct($parentProduct): self |
205
|
|
|
{ |
206
|
|
|
$this->parentProduct = $parentProduct; |
207
|
|
|
return $this; |
208
|
|
|
} |
209
|
|
|
|
210
|
|
|
public function getOrderProduct() |
211
|
|
|
{ |
212
|
|
|
return $this->orderProduct; |
213
|
|
|
} |
214
|
|
|
|
215
|
|
|
public function setOrderProduct($orderProduct): self |
216
|
|
|
{ |
217
|
|
|
$this->orderProduct = $orderProduct; |
218
|
|
|
return $this; |
219
|
|
|
} |
220
|
|
|
|
221
|
|
|
public function getProductGroup() |
222
|
|
|
{ |
223
|
|
|
return $this->productGroup; |
224
|
|
|
} |
225
|
|
|
|
226
|
|
|
public function setProductGroup($productGroup): self |
227
|
|
|
{ |
228
|
|
|
$this->productGroup = $productGroup; |
229
|
|
|
return $this; |
230
|
|
|
} |
231
|
|
|
} |
232
|
|
|
|
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