1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Symfony\Component\Serializer\Attribute\Groups; |
|
|
|
|
6
|
|
|
|
7
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
8
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
9
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
16
|
|
|
use ControleOnline\Listener\LogListener; |
|
|
|
|
17
|
|
|
use ControleOnline\Repository\ProductGroupProductRepository; |
18
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
19
|
|
|
|
20
|
|
|
#[ApiResource( |
21
|
|
|
operations: [ |
22
|
|
|
new Get(security: 'is_granted(\'PUBLIC_ACCESS\')'), |
23
|
|
|
new Put( |
24
|
|
|
security: 'is_granted(\'ROLE_CLIENT\')', |
25
|
|
|
denormalizationContext: ['groups' => ['product_group_product:write']] |
26
|
|
|
), |
27
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
28
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
29
|
|
|
new GetCollection(security: 'is_granted(\'PUBLIC_ACCESS\')') |
30
|
|
|
], |
31
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
32
|
|
|
normalizationContext: ['groups' => ['product_group_product:read']], |
33
|
|
|
denormalizationContext: ['groups' => ['product_group_product:write']] |
34
|
|
|
)] |
35
|
|
|
#[ApiFilter(OrderFilter::class, properties: ['productGroup.productGroup' => 'ASC', 'product.product' => 'ASC'])] |
36
|
|
|
#[ORM\Table(name: 'product_group_product')] |
37
|
|
|
#[ORM\Entity(repositoryClass: ProductGroupProductRepository::class)] |
38
|
|
|
class ProductGroupProduct |
39
|
|
|
{ |
40
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])] |
41
|
|
|
#[ORM\Column(name: 'id', type: 'integer', nullable: false)] |
42
|
|
|
#[ORM\Id] |
43
|
|
|
#[ORM\GeneratedValue(strategy: 'IDENTITY')] |
44
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
45
|
|
|
private $id; |
46
|
|
|
|
47
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])] |
48
|
|
|
#[ORM\JoinColumn(name: 'product_id', referencedColumnName: 'id', nullable: false)] |
49
|
|
|
#[ORM\ManyToOne(targetEntity: Product::class)] |
50
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
51
|
|
|
private $product; |
52
|
|
|
|
53
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productGroup' => 'exact'])] |
54
|
|
|
#[ORM\JoinColumn(name: 'product_group_id', referencedColumnName: 'id', nullable: true)] |
55
|
|
|
#[ORM\ManyToOne(targetEntity: ProductGroup::class)] |
56
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
57
|
|
|
private $productGroup; |
58
|
|
|
|
59
|
|
|
#[ApiFilter(filterClass: SearchFilter::class, properties: ['productType' => 'exact'])] |
60
|
|
|
#[ORM\Column(name: 'product_type', type: 'string', columnDefinition: "ENUM('feedstock', 'component', 'package')", nullable: false)] |
61
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
62
|
|
|
private $productType = 'component'; |
63
|
|
|
|
64
|
|
|
#[ORM\JoinColumn(name: 'product_child_id', referencedColumnName: 'id', nullable: true)] |
65
|
|
|
#[ORM\ManyToOne(targetEntity: Product::class)] |
66
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
67
|
|
|
private $productChild; |
68
|
|
|
|
69
|
|
|
#[ORM\Column(name: 'quantity', type: 'float', precision: 10, scale: 2, nullable: false, options: ['default' => '1.00'])] |
70
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
71
|
|
|
private $quantity = 0; |
72
|
|
|
|
73
|
|
|
#[ORM\Column(name: 'price', type: 'float', precision: 10, scale: 2, nullable: false)] |
74
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
75
|
|
|
private $price = 0; |
76
|
|
|
|
77
|
|
|
#[ORM\Column(name: 'active', type: 'boolean', nullable: false, options: ['default' => '1'])] |
78
|
|
|
#[Groups(['product_group_product:read', 'product_group:write', 'product_group_product:write'])] |
79
|
|
|
private $active = true; |
80
|
|
|
|
81
|
|
|
public function getId() |
82
|
|
|
{ |
83
|
|
|
return $this->id; |
84
|
|
|
} |
85
|
|
|
|
86
|
|
|
public function getProduct(): Product |
87
|
|
|
{ |
88
|
|
|
return $this->product; |
89
|
|
|
} |
90
|
|
|
|
91
|
|
|
public function setProduct(Product $product): self |
92
|
|
|
{ |
93
|
|
|
$this->product = $product; |
94
|
|
|
return $this; |
95
|
|
|
} |
96
|
|
|
|
97
|
|
|
public function getProductGroup(): ?ProductGroup |
98
|
|
|
{ |
99
|
|
|
return $this->productGroup; |
100
|
|
|
} |
101
|
|
|
|
102
|
|
|
public function setProductGroup(?ProductGroup $productGroup): self |
103
|
|
|
{ |
104
|
|
|
$this->productGroup = $productGroup; |
105
|
|
|
return $this; |
106
|
|
|
} |
107
|
|
|
|
108
|
|
|
public function getProductChild(): ?Product |
109
|
|
|
{ |
110
|
|
|
return $this->productChild; |
111
|
|
|
} |
112
|
|
|
|
113
|
|
|
public function setProductChild(?Product $productChild): self |
114
|
|
|
{ |
115
|
|
|
$this->productChild = $productChild; |
116
|
|
|
return $this; |
117
|
|
|
} |
118
|
|
|
|
119
|
|
|
public function getQuantity(): float |
120
|
|
|
{ |
121
|
|
|
return $this->quantity; |
122
|
|
|
} |
123
|
|
|
|
124
|
|
|
public function setQuantity(float $quantity): self |
125
|
|
|
{ |
126
|
|
|
$this->quantity = $quantity; |
127
|
|
|
return $this; |
128
|
|
|
} |
129
|
|
|
|
130
|
|
|
public function getProductType(): string |
131
|
|
|
{ |
132
|
|
|
return $this->productType; |
133
|
|
|
} |
134
|
|
|
|
135
|
|
|
public function setProductType(string $productType): self |
136
|
|
|
{ |
137
|
|
|
$this->productType = $productType; |
138
|
|
|
return $this; |
139
|
|
|
} |
140
|
|
|
|
141
|
|
|
public function getPrice(): float |
142
|
|
|
{ |
143
|
|
|
return $this->price; |
144
|
|
|
} |
145
|
|
|
|
146
|
|
|
public function setPrice(float $price): self |
147
|
|
|
{ |
148
|
|
|
$this->price = $price; |
149
|
|
|
return $this; |
150
|
|
|
} |
151
|
|
|
|
152
|
|
|
public function isActive(): bool |
153
|
|
|
{ |
154
|
|
|
return $this->active; |
155
|
|
|
} |
156
|
|
|
|
157
|
|
|
public function setActive(bool $active): self |
158
|
|
|
{ |
159
|
|
|
$this->active = $active; |
160
|
|
|
return $this; |
161
|
|
|
} |
162
|
|
|
} |
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