1
|
|
|
<?php |
2
|
|
|
|
3
|
|
|
namespace ControleOnline\Entity; |
4
|
|
|
|
5
|
|
|
use Doctrine\ORM\Mapping as ORM; |
|
|
|
|
6
|
|
|
use ControleOnline\Entity\Inventory; |
7
|
|
|
use ControleOnline\Entity\Product; |
8
|
|
|
use ControleOnline\Entity\ProductUnity; |
9
|
|
|
use Symfony\Component\Serializer\Annotation\Groups; |
|
|
|
|
10
|
|
|
use ApiPlatform\Metadata\GetCollection; |
|
|
|
|
11
|
|
|
use ApiPlatform\Metadata\Post; |
|
|
|
|
12
|
|
|
use ApiPlatform\Metadata\Delete; |
|
|
|
|
13
|
|
|
use ApiPlatform\Metadata\Put; |
|
|
|
|
14
|
|
|
use ApiPlatform\Metadata\Get; |
|
|
|
|
15
|
|
|
use ApiPlatform\Metadata\ApiResource; |
|
|
|
|
16
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter; |
|
|
|
|
17
|
|
|
use ApiPlatform\Metadata\ApiFilter; |
|
|
|
|
18
|
|
|
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter; |
|
|
|
|
19
|
|
|
|
20
|
|
|
/** |
21
|
|
|
* ProductInventory |
22
|
|
|
* |
23
|
|
|
* @ORM\Table(name="product_inventory", indexes={@ORM\Index(name="inventory_id", columns={"inventory_id"}), @ORM\Index(name="product_id", columns={"product_id"})}) |
24
|
|
|
* @ORM\Entity(repositoryClass="ControleOnline\Repository\ProductInventoryRepository") |
25
|
|
|
*/ |
26
|
|
|
#[ApiResource( |
27
|
|
|
operations: [ |
28
|
|
|
new Get(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
29
|
|
|
new Put(security: 'is_granted(\'ROLE_CLIENT\')', denormalizationContext: ['groups' => ['product_inventory:write']]), |
30
|
|
|
new Delete(security: 'is_granted(\'ROLE_CLIENT\')'), |
31
|
|
|
new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'), |
32
|
|
|
new GetCollection(security: 'is_granted(\'IS_AUTHENTICATED_ANONYMOUSLY\')'), |
33
|
|
|
], |
34
|
|
|
formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']], |
35
|
|
|
normalizationContext: ['groups' => ['product_inventory:read']], |
36
|
|
|
denormalizationContext: ['groups' => ['product_inventory:write']] |
37
|
|
|
)] |
38
|
|
|
#[ApiFilter(OrderFilter::class, properties: ['id', 'available', 'sales', 'ordered', 'transit'])] |
39
|
|
|
#[ApiFilter(SearchFilter::class, properties: ['id' => 'exact', 'inventory' => 'exact', 'product' => 'exact', 'productUnity' => 'exact'])] |
40
|
|
|
class ProductInventory |
41
|
|
|
{ |
42
|
|
|
/** |
43
|
|
|
* @var int |
44
|
|
|
* @ORM\Column(name="id", type="integer", nullable=false) |
45
|
|
|
* @ORM\Id |
46
|
|
|
* @ORM\GeneratedValue(strategy="IDENTITY") |
47
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
48
|
|
|
*/ |
49
|
|
|
private $id; |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* @var \ControleOnline\Entity\Inventory |
53
|
|
|
* @ORM\ManyToOne(targetEntity="\ControleOnline\Entity\Inventory") |
54
|
|
|
* @ORM\JoinColumns({ |
55
|
|
|
* @ORM\JoinColumn(name="inventory_id", referencedColumnName="id", nullable=false) |
56
|
|
|
* }) |
57
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
58
|
|
|
*/ |
59
|
|
|
private $inventory; |
60
|
|
|
|
61
|
|
|
/** |
62
|
|
|
* @var \ControleOnline\Entity\Product |
63
|
|
|
* @ORM\ManyToOne(targetEntity="\ControleOnline\Entity\Product") |
64
|
|
|
* @ORM\JoinColumns({ |
65
|
|
|
* @ORM\JoinColumn(name="product_id", referencedColumnName="id", nullable=false) |
66
|
|
|
* }) |
67
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
68
|
|
|
*/ |
69
|
|
|
private $product; |
70
|
|
|
|
71
|
|
|
|
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* @var int |
75
|
|
|
* @ORM\Column(name="available", type="integer", nullable=false, options={"default"=0}) |
76
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
77
|
|
|
*/ |
78
|
|
|
private $available = 0; |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* @var int |
82
|
|
|
* @ORM\Column(name="sales", type="integer", nullable=false, options={"default"=0}) |
83
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
84
|
|
|
*/ |
85
|
|
|
private $sales = 0; |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* @var int |
89
|
|
|
* @ORM\Column(name="ordered", type="integer", nullable=false, options={"default"=0}) |
90
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
91
|
|
|
*/ |
92
|
|
|
private $ordered = 0; |
93
|
|
|
|
94
|
|
|
/** |
95
|
|
|
* @var int |
96
|
|
|
* @ORM\Column(name="transit", type="integer", nullable=false, options={"default"=0}) |
97
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
98
|
|
|
*/ |
99
|
|
|
private $transit = 0; |
100
|
|
|
|
101
|
|
|
/** |
102
|
|
|
* @var int |
103
|
|
|
* @ORM\Column(name="minimum", type="integer", nullable=false, options={"default"=0}) |
104
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
105
|
|
|
*/ |
106
|
|
|
private $minimum = 0; |
107
|
|
|
|
108
|
|
|
/** |
109
|
|
|
* @var int |
110
|
|
|
* @ORM\Column(name="maximum", type="integer", nullable=false, options={"default"=0}) |
111
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
112
|
|
|
*/ |
113
|
|
|
private $maximum = 0; |
114
|
|
|
|
115
|
|
|
public function getId(): ?int |
116
|
|
|
{ |
117
|
|
|
return $this->id; |
118
|
|
|
} |
119
|
|
|
|
120
|
|
|
public function setId(int $id): self |
121
|
|
|
{ |
122
|
|
|
$this->id = $id; |
123
|
|
|
return $this; |
124
|
|
|
} |
125
|
|
|
|
126
|
|
|
public function getInventory(): ?Inventory |
127
|
|
|
{ |
128
|
|
|
return $this->inventory; |
129
|
|
|
} |
130
|
|
|
|
131
|
|
|
public function setInventory(Inventory $inventory): self |
132
|
|
|
{ |
133
|
|
|
$this->inventory = $inventory; |
134
|
|
|
return $this; |
135
|
|
|
} |
136
|
|
|
|
137
|
|
|
public function getProduct(): ?Product |
138
|
|
|
{ |
139
|
|
|
return $this->product; |
140
|
|
|
} |
141
|
|
|
|
142
|
|
|
public function setProduct(Product $product): self |
143
|
|
|
{ |
144
|
|
|
$this->product = $product; |
145
|
|
|
return $this; |
146
|
|
|
} |
147
|
|
|
|
148
|
|
|
public function getAvailable(): int |
149
|
|
|
{ |
150
|
|
|
return $this->available; |
151
|
|
|
} |
152
|
|
|
|
153
|
|
|
public function setAvailable(int $available): self |
154
|
|
|
{ |
155
|
|
|
$this->available = $available; |
156
|
|
|
return $this; |
157
|
|
|
} |
158
|
|
|
|
159
|
|
|
public function getSales(): int |
160
|
|
|
{ |
161
|
|
|
return $this->sales; |
162
|
|
|
} |
163
|
|
|
|
164
|
|
|
public function setSales(int $sales): self |
165
|
|
|
{ |
166
|
|
|
$this->sales = $sales; |
167
|
|
|
return $this; |
168
|
|
|
} |
169
|
|
|
|
170
|
|
|
public function getOrdered(): int |
171
|
|
|
{ |
172
|
|
|
return $this->ordered; |
173
|
|
|
} |
174
|
|
|
|
175
|
|
|
public function setOrdered(int $ordered): self |
176
|
|
|
{ |
177
|
|
|
$this->ordered = $ordered; |
178
|
|
|
return $this; |
179
|
|
|
} |
180
|
|
|
|
181
|
|
|
public function getTransit(): int |
182
|
|
|
{ |
183
|
|
|
return $this->transit; |
184
|
|
|
} |
185
|
|
|
|
186
|
|
|
public function setTransit(int $transit): self |
187
|
|
|
{ |
188
|
|
|
$this->transit = $transit; |
189
|
|
|
return $this; |
190
|
|
|
} |
191
|
|
|
|
192
|
|
|
public function getMinimum(): int |
193
|
|
|
{ |
194
|
|
|
return $this->minimum; |
195
|
|
|
} |
196
|
|
|
|
197
|
|
|
public function setMinimum(int $minimum): self |
198
|
|
|
{ |
199
|
|
|
$this->minimum = $minimum; |
200
|
|
|
return $this; |
201
|
|
|
} |
202
|
|
|
|
203
|
|
|
public function getMaximum(): int |
204
|
|
|
{ |
205
|
|
|
return $this->maximum; |
206
|
|
|
} |
207
|
|
|
|
208
|
|
|
public function setMaximum(int $maximum): self |
209
|
|
|
{ |
210
|
|
|
$this->maximum = $maximum; |
211
|
|
|
return $this; |
212
|
|
|
} |
213
|
|
|
} |
214
|
|
|
|
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