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\Product") |
66
|
|
|
* @ORM\JoinColumn(nullable=true) |
67
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
68
|
|
|
*/ |
69
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['parentProduct'])] |
70
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['parentProduct' => 'exact'])] |
71
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['parentProduct.type' => 'exact'])] |
72
|
|
|
private $parentProduct; |
73
|
|
|
|
74
|
|
|
/** |
75
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\OrderProduct") |
76
|
|
|
* @ORM\JoinColumn(nullable=true) |
77
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
78
|
|
|
*/ |
79
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['orderProduct'])] |
80
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderProduct' => 'exact'])] |
81
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['orderProduct.type' => 'exact'])] |
82
|
|
|
private $orderProduct; |
83
|
|
|
|
84
|
|
|
/** |
85
|
|
|
* @ORM\ManyToOne(targetEntity="ControleOnline\Entity\ProductGroup") |
86
|
|
|
* @ORM\JoinColumn(nullable=true) |
87
|
|
|
* @Groups({"order_product:write","order_product:read"}) |
88
|
|
|
*/ |
89
|
|
|
#[ApiFilter(ExistsFilter::class, properties: ['productGroup'])] |
90
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
91
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup.type' => 'exact'])] |
92
|
|
|
private $productGroup; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @ORM\Column(type="float") |
96
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
97
|
|
|
*/ |
98
|
|
|
private $quantity = 1; |
99
|
|
|
|
100
|
|
|
/** |
101
|
|
|
* @ORM\Column(type="float") |
102
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
103
|
|
|
*/ |
104
|
|
|
private $price = 0; |
105
|
|
|
|
106
|
|
|
/** |
107
|
|
|
* @ORM\Column(type="float") |
108
|
|
|
* @Groups({"order_product_queue:read","order:read","order_details:read","order:write","order_product:write","order_product:read"}) |
109
|
|
|
*/ |
110
|
|
|
private $total = 0; |
111
|
|
|
|
112
|
|
|
// Getters and setters |
113
|
|
|
|
114
|
|
|
public function getId() |
115
|
|
|
{ |
116
|
|
|
return $this->id; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function setId($id): self |
120
|
|
|
{ |
121
|
|
|
$this->id = $id; |
122
|
|
|
return $this; |
123
|
|
|
} |
124
|
|
|
|
125
|
|
|
public function getOrder() |
126
|
|
|
{ |
127
|
|
|
return $this->order; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function setOrder($order): self |
131
|
|
|
{ |
132
|
|
|
$this->order = $order; |
133
|
|
|
return $this; |
134
|
|
|
} |
135
|
|
|
|
136
|
|
|
public function getProduct() |
137
|
|
|
{ |
138
|
|
|
return $this->product; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function setProduct($product): self |
142
|
|
|
{ |
143
|
|
|
$this->product = $product; |
144
|
|
|
return $this; |
145
|
|
|
} |
146
|
|
|
|
147
|
|
|
public function getQuantity() |
148
|
|
|
{ |
149
|
|
|
return $this->quantity; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function setQuantity($quantity): self |
153
|
|
|
{ |
154
|
|
|
$this->quantity = $quantity; |
155
|
|
|
return $this; |
156
|
|
|
} |
157
|
|
|
|
158
|
|
|
public function getPrice() |
159
|
|
|
{ |
160
|
|
|
return $this->price; |
161
|
|
|
} |
162
|
|
|
|
163
|
|
|
public function setPrice($price): self |
164
|
|
|
{ |
165
|
|
|
$this->price = $price; |
166
|
|
|
return $this; |
167
|
|
|
} |
168
|
|
|
|
169
|
|
|
public function getTotal() |
170
|
|
|
{ |
171
|
|
|
return $this->total; |
172
|
|
|
} |
173
|
|
|
|
174
|
|
|
public function setTotal($total): self |
175
|
|
|
{ |
176
|
|
|
$this->total = $total; |
177
|
|
|
return $this; |
178
|
|
|
} |
179
|
|
|
|
180
|
|
|
public function getParentProduct() |
181
|
|
|
{ |
182
|
|
|
return $this->parentProduct; |
183
|
|
|
} |
184
|
|
|
|
185
|
|
|
public function setParentProduct($parentProduct): self |
186
|
|
|
{ |
187
|
|
|
$this->parentProduct = $parentProduct; |
188
|
|
|
return $this; |
189
|
|
|
} |
190
|
|
|
|
191
|
|
|
public function getOrderProduct() |
192
|
|
|
{ |
193
|
|
|
return $this->orderProduct; |
194
|
|
|
} |
195
|
|
|
|
196
|
|
|
public function setOrderProduct($orderProduct): self |
197
|
|
|
{ |
198
|
|
|
$this->orderProduct = $orderProduct; |
199
|
|
|
return $this; |
200
|
|
|
} |
201
|
|
|
|
202
|
|
|
public function getProductGroup() |
203
|
|
|
{ |
204
|
|
|
return $this->productGroup; |
205
|
|
|
} |
206
|
|
|
|
207
|
|
|
public function setProductGroup($productGroup): self |
208
|
|
|
{ |
209
|
|
|
$this->productGroup = $productGroup; |
210
|
|
|
return $this; |
211
|
|
|
} |
212
|
|
|
} |
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