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