|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
|
|
6
|
|
|
|
|
7
|
|
|
/** |
|
8
|
|
|
* ProductGroupProducts |
|
9
|
|
|
* |
|
10
|
|
|
* @ORM\Table(name="product_group_product") |
|
11
|
|
|
* @ORM\Entity(repositoryClass="ControleOnline\Repository\ProductGroupProductRepository") |
|
12
|
|
|
*/ |
|
13
|
|
|
|
|
14
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
|
|
16
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
|
|
17
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
|
|
18
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
|
|
19
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
|
|
20
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
|
|
21
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
|
|
22
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
|
|
23
|
|
|
|
|
24
|
|
|
#[ApiResource( |
|
25
|
|
|
operations: [ |
|
26
|
|
|
new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'), |
|
27
|
|
|
new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_group_write']]), |
|
28
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
|
29
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
|
30
|
|
|
new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')') |
|
31
|
|
|
], |
|
32
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
|
33
|
|
|
normalizationContext: ['groups' => ['product_group_product_read']], |
|
34
|
|
|
denormalizationContext: ['groups' => ['product_group_product_write']] |
|
35
|
|
|
)] |
|
36
|
|
|
class ProductGroupProduct |
|
37
|
|
|
{ |
|
38
|
|
|
/** |
|
39
|
|
|
* @var int |
|
40
|
|
|
* |
|
41
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
|
42
|
|
|
* @ORM\Id |
|
43
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
|
44
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
45
|
|
|
*/ |
|
46
|
|
|
private $id; |
|
47
|
|
|
|
|
48
|
|
|
/** |
|
49
|
|
|
* @var Product |
|
50
|
|
|
* |
|
51
|
|
|
* @ORM\ManyToOne(targetEntity="Product") |
|
52
|
|
|
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=false) |
|
53
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
54
|
|
|
|
|
55
|
|
|
*/ |
|
56
|
|
|
private $product; |
|
57
|
|
|
|
|
58
|
|
|
/** |
|
59
|
|
|
* @var ProductGroup |
|
60
|
|
|
* |
|
61
|
|
|
* @ORM\ManyToOne(targetEntity="ProductGroup") |
|
62
|
|
|
* @ORM\JoinColumn(name="product_group_id", referencedColumnName="id", nullable=true) |
|
63
|
|
|
* @Groups({"product_group_product_read","product_group_write","product_group_product_write"}) |
|
64
|
|
|
|
|
65
|
|
|
*/ |
|
66
|
|
|
private $productGroup; |
|
67
|
|
|
|
|
68
|
|
|
/** |
|
69
|
|
|
* @var string |
|
70
|
|
|
* |
|
71
|
|
|
* @ORM\Column(name="product_type", type="string", columnDefinition="ENUM('feedstock', 'component', 'package')", nullable=false) |
|
72
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
73
|
|
|
|
|
74
|
|
|
*/ |
|
75
|
|
|
private $productType; |
|
76
|
|
|
|
|
77
|
|
|
/** |
|
78
|
|
|
* @var Product |
|
79
|
|
|
* |
|
80
|
|
|
* @ORM\ManyToOne(targetEntity="Product") |
|
81
|
|
|
* @ORM\JoinColumn(name="product_child_id", referencedColumnName="id", nullable=false) |
|
82
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
83
|
|
|
|
|
84
|
|
|
*/ |
|
85
|
|
|
private $productChild; |
|
86
|
|
|
|
|
87
|
|
|
/** |
|
88
|
|
|
* @var float |
|
89
|
|
|
* |
|
90
|
|
|
* @ORM\Column(name="quantity", type="float", precision=10, scale=2, nullable=false, options={"default"="1.00"}) |
|
91
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
92
|
|
|
|
|
93
|
|
|
*/ |
|
94
|
|
|
private $quantity = 0; |
|
95
|
|
|
|
|
96
|
|
|
/** |
|
97
|
|
|
* @var float |
|
98
|
|
|
* |
|
99
|
|
|
* @ORM\Column(name="price", type="float", precision=10, scale=2, nullable=false) |
|
100
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
101
|
|
|
|
|
102
|
|
|
*/ |
|
103
|
|
|
private $price; |
|
104
|
|
|
|
|
105
|
|
|
/** |
|
106
|
|
|
* @var bool |
|
107
|
|
|
* |
|
108
|
|
|
* @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"}) |
|
109
|
|
|
* @Groups({"product_group_read","product_group_product_read","product_group_write","product_group_product_write"}) |
|
110
|
|
|
|
|
111
|
|
|
*/ |
|
112
|
|
|
private $active = true; |
|
113
|
|
|
|
|
114
|
|
|
/** |
|
115
|
|
|
* Get the value of id |
|
116
|
|
|
*/ |
|
117
|
|
|
public function getId(): int |
|
118
|
|
|
{ |
|
119
|
|
|
return $this->id; |
|
120
|
|
|
} |
|
121
|
|
|
|
|
122
|
|
|
|
|
123
|
|
|
|
|
124
|
|
|
public function getProduct(): Product |
|
125
|
|
|
{ |
|
126
|
|
|
return $this->product; |
|
127
|
|
|
} |
|
128
|
|
|
|
|
129
|
|
|
/** |
|
130
|
|
|
* Set the value of product |
|
131
|
|
|
*/ |
|
132
|
|
|
public function setProduct(Product $product): self |
|
133
|
|
|
{ |
|
134
|
|
|
$this->product = $product; |
|
135
|
|
|
|
|
136
|
|
|
return $this; |
|
137
|
|
|
} |
|
138
|
|
|
|
|
139
|
|
|
/** |
|
140
|
|
|
* Get the value of productGroup |
|
141
|
|
|
*/ |
|
142
|
|
|
public function getProductGroup(): ?ProductGroup |
|
143
|
|
|
{ |
|
144
|
|
|
return $this->productGroup; |
|
145
|
|
|
} |
|
146
|
|
|
|
|
147
|
|
|
/** |
|
148
|
|
|
* Set the value of productGroup |
|
149
|
|
|
*/ |
|
150
|
|
|
public function setProductGroup(?ProductGroup $productGroup): self |
|
151
|
|
|
{ |
|
152
|
|
|
$this->productGroup = $productGroup; |
|
153
|
|
|
|
|
154
|
|
|
return $this; |
|
155
|
|
|
} |
|
156
|
|
|
|
|
157
|
|
|
/** |
|
158
|
|
|
* Get the value of productChild |
|
159
|
|
|
*/ |
|
160
|
|
|
public function getProductChild(): Product |
|
161
|
|
|
{ |
|
162
|
|
|
return $this->productChild; |
|
163
|
|
|
} |
|
164
|
|
|
|
|
165
|
|
|
/** |
|
166
|
|
|
* Set the value of productChild |
|
167
|
|
|
*/ |
|
168
|
|
|
public function setProductChild(Product $productChild): self |
|
169
|
|
|
{ |
|
170
|
|
|
$this->productChild = $productChild; |
|
171
|
|
|
|
|
172
|
|
|
return $this; |
|
173
|
|
|
} |
|
174
|
|
|
|
|
175
|
|
|
/** |
|
176
|
|
|
* Get the value of quantity |
|
177
|
|
|
*/ |
|
178
|
|
|
public function getQuantity(): float |
|
179
|
|
|
{ |
|
180
|
|
|
return $this->quantity; |
|
181
|
|
|
} |
|
182
|
|
|
|
|
183
|
|
|
/** |
|
184
|
|
|
* Set the value of quantity |
|
185
|
|
|
*/ |
|
186
|
|
|
public function setQuantity(float $quantity): self |
|
187
|
|
|
{ |
|
188
|
|
|
$this->quantity = $quantity; |
|
189
|
|
|
|
|
190
|
|
|
return $this; |
|
191
|
|
|
} |
|
192
|
|
|
|
|
193
|
|
|
/** |
|
194
|
|
|
* Get the value of productType |
|
195
|
|
|
*/ |
|
196
|
|
|
public function getProductType(): string |
|
197
|
|
|
{ |
|
198
|
|
|
return $this->productType; |
|
199
|
|
|
} |
|
200
|
|
|
|
|
201
|
|
|
/** |
|
202
|
|
|
* Set the value of productType |
|
203
|
|
|
*/ |
|
204
|
|
|
public function setProductType(string $productType): self |
|
205
|
|
|
{ |
|
206
|
|
|
$this->productType = $productType; |
|
207
|
|
|
|
|
208
|
|
|
return $this; |
|
209
|
|
|
} |
|
210
|
|
|
|
|
211
|
|
|
/** |
|
212
|
|
|
* Get the value of price |
|
213
|
|
|
*/ |
|
214
|
|
|
public function getPrice(): float |
|
215
|
|
|
{ |
|
216
|
|
|
return $this->price; |
|
217
|
|
|
} |
|
218
|
|
|
|
|
219
|
|
|
/** |
|
220
|
|
|
* Set the value of price |
|
221
|
|
|
*/ |
|
222
|
|
|
public function setPrice(float $price): self |
|
223
|
|
|
{ |
|
224
|
|
|
$this->price = $price; |
|
225
|
|
|
|
|
226
|
|
|
return $this; |
|
227
|
|
|
} |
|
228
|
|
|
|
|
229
|
|
|
/** |
|
230
|
|
|
* Get the value of active |
|
231
|
|
|
*/ |
|
232
|
|
|
public function isActive(): bool |
|
233
|
|
|
{ |
|
234
|
|
|
return $this->active; |
|
235
|
|
|
} |
|
236
|
|
|
|
|
237
|
|
|
/** |
|
238
|
|
|
* Set the value of active |
|
239
|
|
|
*/ |
|
240
|
|
|
public function setActive(bool $active): self |
|
241
|
|
|
{ |
|
242
|
|
|
$this->active = $active; |
|
243
|
|
|
|
|
244
|
|
|
return $this; |
|
245
|
|
|
} |
|
246
|
|
|
} |
|
247
|
|
|
|
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