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"}), @ORM\Index(name="product_unity_id", columns={"product_unity_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
|
|
|
* @var \ControleOnline\Entity\ProductUnity |
73
|
|
|
* @ORM\ManyToOne(targetEntity="\ControleOnline\Entity\ProductUnity") |
74
|
|
|
* @ORM\JoinColumns({ |
75
|
|
|
* @ORM\JoinColumn(name="product_unity_id", referencedColumnName="id", nullable=false) |
76
|
|
|
* }) |
77
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
78
|
|
|
*/ |
79
|
|
|
private $productUnity; |
80
|
|
|
|
81
|
|
|
/** |
82
|
|
|
* @var int |
83
|
|
|
* @ORM\Column(name="available", type="integer", nullable=false, options={"default"=0}) |
84
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
85
|
|
|
*/ |
86
|
|
|
private $available = 0; |
87
|
|
|
|
88
|
|
|
/** |
89
|
|
|
* @var int |
90
|
|
|
* @ORM\Column(name="sales", type="integer", nullable=false, options={"default"=0}) |
91
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
92
|
|
|
*/ |
93
|
|
|
private $sales = 0; |
94
|
|
|
|
95
|
|
|
/** |
96
|
|
|
* @var int |
97
|
|
|
* @ORM\Column(name="ordered", type="integer", nullable=false, options={"default"=0}) |
98
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
99
|
|
|
*/ |
100
|
|
|
private $ordered = 0; |
101
|
|
|
|
102
|
|
|
/** |
103
|
|
|
* @var int |
104
|
|
|
* @ORM\Column(name="transit", type="integer", nullable=false, options={"default"=0}) |
105
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
106
|
|
|
*/ |
107
|
|
|
private $transit = 0; |
108
|
|
|
|
109
|
|
|
/** |
110
|
|
|
* @var int |
111
|
|
|
* @ORM\Column(name="minimum", type="integer", nullable=false, options={"default"=0}) |
112
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
113
|
|
|
*/ |
114
|
|
|
private $minimum = 0; |
115
|
|
|
|
116
|
|
|
/** |
117
|
|
|
* @var int |
118
|
|
|
* @ORM\Column(name="maximum", type="integer", nullable=false, options={"default"=0}) |
119
|
|
|
* @Groups({"product_inventory:read", "product_inventory:write"}) |
120
|
|
|
*/ |
121
|
|
|
private $maximum = 0; |
122
|
|
|
|
123
|
|
|
public function getId(): ?int |
124
|
|
|
{ |
125
|
|
|
return $this->id; |
126
|
|
|
} |
127
|
|
|
|
128
|
|
|
public function setId(int $id): self |
129
|
|
|
{ |
130
|
|
|
$this->id = $id; |
131
|
|
|
return $this; |
132
|
|
|
} |
133
|
|
|
|
134
|
|
|
public function getInventory(): ?Inventory |
135
|
|
|
{ |
136
|
|
|
return $this->inventory; |
137
|
|
|
} |
138
|
|
|
|
139
|
|
|
public function setInventory(Inventory $inventory): self |
140
|
|
|
{ |
141
|
|
|
$this->inventory = $inventory; |
142
|
|
|
return $this; |
143
|
|
|
} |
144
|
|
|
|
145
|
|
|
public function getProduct(): ?Product |
146
|
|
|
{ |
147
|
|
|
return $this->product; |
148
|
|
|
} |
149
|
|
|
|
150
|
|
|
public function setProduct(Product $product): self |
151
|
|
|
{ |
152
|
|
|
$this->product = $product; |
153
|
|
|
return $this; |
154
|
|
|
} |
155
|
|
|
|
156
|
|
|
public function getProductUnity(): ?ProductUnity |
157
|
|
|
{ |
158
|
|
|
return $this->productUnity; |
159
|
|
|
} |
160
|
|
|
|
161
|
|
|
public function setProductUnity(ProductUnity $productUnity): self |
162
|
|
|
{ |
163
|
|
|
$this->productUnity = $productUnity; |
164
|
|
|
return $this; |
165
|
|
|
} |
166
|
|
|
|
167
|
|
|
public function getAvailable(): int |
168
|
|
|
{ |
169
|
|
|
return $this->available; |
170
|
|
|
} |
171
|
|
|
|
172
|
|
|
public function setAvailable(int $available): self |
173
|
|
|
{ |
174
|
|
|
$this->available = $available; |
175
|
|
|
return $this; |
176
|
|
|
} |
177
|
|
|
|
178
|
|
|
public function getSales(): int |
179
|
|
|
{ |
180
|
|
|
return $this->sales; |
181
|
|
|
} |
182
|
|
|
|
183
|
|
|
public function setSales(int $sales): self |
184
|
|
|
{ |
185
|
|
|
$this->sales = $sales; |
186
|
|
|
return $this; |
187
|
|
|
} |
188
|
|
|
|
189
|
|
|
public function getOrdered(): int |
190
|
|
|
{ |
191
|
|
|
return $this->ordered; |
192
|
|
|
} |
193
|
|
|
|
194
|
|
|
public function setOrdered(int $ordered): self |
195
|
|
|
{ |
196
|
|
|
$this->ordered = $ordered; |
197
|
|
|
return $this; |
198
|
|
|
} |
199
|
|
|
|
200
|
|
|
public function getTransit(): int |
201
|
|
|
{ |
202
|
|
|
return $this->transit; |
203
|
|
|
} |
204
|
|
|
|
205
|
|
|
public function setTransit(int $transit): self |
206
|
|
|
{ |
207
|
|
|
$this->transit = $transit; |
208
|
|
|
return $this; |
209
|
|
|
} |
210
|
|
|
|
211
|
|
|
public function getMinimum(): int |
212
|
|
|
{ |
213
|
|
|
return $this->minimum; |
214
|
|
|
} |
215
|
|
|
|
216
|
|
|
public function setMinimum(int $minimum): self |
217
|
|
|
{ |
218
|
|
|
$this->minimum = $minimum; |
219
|
|
|
return $this; |
220
|
|
|
} |
221
|
|
|
|
222
|
|
|
public function getMaximum(): int |
223
|
|
|
{ |
224
|
|
|
return $this->maximum; |
225
|
|
|
} |
226
|
|
|
|
227
|
|
|
public function setMaximum(int $maximum): self |
228
|
|
|
{ |
229
|
|
|
$this->maximum = $maximum; |
230
|
|
|
return $this; |
231
|
|
|
} |
232
|
|
|
} |
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