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