Passed
Push — master ( d61140...9779d9 )
by Luiz Kim
02:24
created

Product::getQueue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 1
c 1
b 0
f 0
dl 0
loc 3
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ControleOnline\Entity;
4
5
use Doctrine\ORM\Mapping as ORM;
0 ignored issues
show
Bug introduced by
The type Doctrine\ORM\Mapping was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
6
use ControleOnline\Entity\People;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\People was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
7
use ControleOnline\Entity\ProductUnity;
8
use Symfony\Component\Serializer\Annotation\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Annotation\Groups was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
9
use ApiPlatform\Metadata\GetCollection;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\GetCollection was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
10
use ApiPlatform\Metadata\Post;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Post was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
11
use ApiPlatform\Metadata\Delete;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Delete was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
12
use ApiPlatform\Metadata\Put;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Put was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
13
use ApiPlatform\Metadata\Get;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\Get was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
14
use ApiPlatform\Metadata\ApiResource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiResource was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
15
use ApiPlatform\Doctrine\Orm\Filter\SearchFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\SearchFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
16
use ApiPlatform\Metadata\ApiFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiFilter was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
17
18
19
/**
20
 * Product
21
 *
22
 * @ORM\Table(name="product", uniqueConstraints={@ORM\UniqueConstraint(name="company_id", columns={"company_id", "sku"})}, indexes={@ORM\Index(name="product_unit_id", columns={"product_unit_id"}), @ORM\Index(name="IDX_D34A04AD979B1AD6", columns={"company_id"})})
23
 * @ORM\Entity(repositoryClass="ControleOnline\Repository\ProductRepository")
24
 */
25
26
#[ApiResource(
27
    operations: [
28
        new Get(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')'),
29
        new Put(
30
            security: 'is_granted(\'ROLE_CLIENT\')',
31
            denormalizationContext: ['groups' => ['product:write']]
32
        ),
33
        new Delete(security: 'is_granted(\'ROLE_CLIENT\')'),
34
        new Post(securityPostDenormalize: 'is_granted(\'ROLE_CLIENT\')'),
35
        new GetCollection(security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')')
36
    ],
37
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
38
    normalizationContext: ['groups' => ['product:read']],
39
    denormalizationContext: ['groups' => ['product:write']]
40
)]
41
42
43
class Product
44
{
45
    /**
46
     * @var int
47
     *
48
     * @ORM\Column(name="id", type="integer", nullable=false)
49
     * @ORM\Id
50
     * @ORM\GeneratedValue(strategy="IDENTITY")
51
     * @Groups({"product_category:read","product:read","order_product:read"})
52
     */
53
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
54
55
    private $id;
56
57
    /**
58
     * @var string
59
     *
60
     * @ORM\Column(name="product", type="string", length=255, nullable=false)
61
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
62
     */
63
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['product' => 'exact'])]
64
65
    private $product;
66
67
    /**
68
     * @var string|null
69
     *
70
     * @ORM\Column(name="sku", type="string", length=32, nullable=true, options={"default"="NULL"})
71
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
72
     */
73
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['sku' => 'exact'])]
74
75
    private $sku = NULL;
76
77
    /**
78
     * @var string
79
     *
80
     * @ORM\Column(name="type", type="string", length=0, nullable=false, options={"default"="'product'"})
81
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
82
     */
83
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['type' => 'exact'])]
84
    private $type = 'product';
85
86
    /**
87
     * @var float
88
     *
89
     * @ORM\Column(name="price", type="float", precision=10, scale=0, nullable=false)
90
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
91
     */
92
    private $price = 0;
93
94
    /**
95
     * @var string
96
     *
97
     * @ORM\Column(name="product_condition", type="string", length=0, nullable=false, options={"default"="'new'"})
98
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
99
     */
100
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['productCondition' => 'exact'])]
101
102
    private $productCondition = 'new';
103
104
105
    /**
106
     * @var string
107
     *
108
     * @ORM\Column(name="description", type="string", length=0, nullable=false)
109
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
110
     */
111
    private $description = '';
112
113
    /**
114
     * @var bool
115
     *
116
     * @ORM\Column(name="active", type="boolean", nullable=false, options={"default"="1"})
117
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
118
     */
119
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['active' => 'exact'])]
120
121
    private $active = true;
122
123
    /**
124
     * @var \ControleOnline\Entity\People
125
     *
126
     * @ORM\ManyToOne(targetEntity="\ControleOnline\Entity\People")
127
     * @ORM\JoinColumns({
128
     *   @ORM\JoinColumn(name="company_id", referencedColumnName="id")
129
     * })
130
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
131
     */
132
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['company' => 'exact'])]
133
134
    private $company;
135
136
    /**
137
     * @var ProductUnity
138
     *
139
     * @ORM\ManyToOne(targetEntity="ProductUnity")
140
     * @ORM\JoinColumns({
141
     *   @ORM\JoinColumn(name="product_unit_id", referencedColumnName="id")
142
     * })
143
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
144
     */
145
    private $productUnit;
146
147
     /**
148
     * @var Queue
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Queue was not found. Maybe you did not declare it correctly or list all dependencies?

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:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
149
     *
150
     * @ORM\ManyToOne(targetEntity="Queue")
151
     * @ORM\JoinColumns({
152
     *   @ORM\JoinColumn(name="queue_id", referencedColumnName="id")
153
     * })
154
     * @Groups({"product_category:read","product:read","product_group_product:read","order_product:read","order:read","order_details:read","order:write","product:write"})
155
     */
156
    private $queue;
157
158
    /**
159
     * Get the value of id
160
     */
161
    public function getId(): int
162
    {
163
        return $this->id;
164
    }
165
166
    /**
167
     * Set the value of id
168
     */
169
    public function setId(int $id): self
170
    {
171
        $this->id = $id;
172
173
        return $this;
174
    }
175
176
    /**
177
     * Get the value of product
178
     */
179
    public function getProduct(): string
180
    {
181
        return $this->product;
182
    }
183
184
    /**
185
     * Set the value of product
186
     */
187
    public function setProduct(string $product): self
188
    {
189
        $this->product = $product;
190
191
        return $this;
192
    }
193
194
    /**
195
     * Get the value of sku
196
     */
197
    public function getSku(): ?string
198
    {
199
        return $this->sku;
200
    }
201
202
    /**
203
     * Set the value of sku
204
     */
205
    public function setSku(?string $sku): self
206
    {
207
        $this->sku = $sku;
208
209
        return $this;
210
    }
211
212
    /**
213
     * Get the value of type
214
     */
215
    public function getType(): string
216
    {
217
        return $this->type;
218
    }
219
220
    /**
221
     * Set the value of type
222
     */
223
    public function setType(string $type): self
224
    {
225
        $this->type = $type;
226
227
        return $this;
228
    }
229
230
    /**
231
     * Get the value of price
232
     */
233
    public function getPrice(): float
234
    {
235
        return $this->price;
236
    }
237
238
    /**
239
     * Set the value of price
240
     */
241
    public function setPrice(float $price): self
242
    {
243
        $this->price = $price;
244
245
        return $this;
246
    }
247
248
    /**
249
     * Get the value of productCondition
250
     */
251
    public function getProductCondition(): string
252
    {
253
        return $this->productCondition;
254
    }
255
256
    /**
257
     * Set the value of productCondition
258
     */
259
    public function setProductCondition(string $productCondition): self
260
    {
261
        $this->productCondition = $productCondition;
262
263
        return $this;
264
    }
265
266
    /**
267
     * Get the value of active
268
     */
269
    public function isActive(): bool
270
    {
271
        return $this->active;
272
    }
273
274
    /**
275
     * Set the value of active
276
     */
277
    public function setActive(bool $active): self
278
    {
279
        $this->active = $active;
280
281
        return $this;
282
    }
283
284
    /**
285
     * Get the value of company
286
     */
287
    public function getCompany(): ?People
288
    {
289
        return $this->company;
290
    }
291
292
    /**
293
     * Set the value of company
294
     */
295
    public function setCompany(People $company): self
296
    {
297
        $this->company = $company;
298
299
        return $this;
300
    }
301
302
    /**
303
     * Get the value of productUnit
304
     */
305
    public function getProductUnit(): ProductUnity
306
    {
307
        return $this->productUnit;
308
    }
309
310
    /**
311
     * Set the value of productUnit
312
     */
313
    public function setProductUnit(ProductUnity $productUnit): self
314
    {
315
        $this->productUnit = $productUnit;
316
317
        return $this;
318
    }
319
320
    public function getActive(): ?bool
321
    {
322
        return $this->active;
323
    }
324
325
    /**
326
     * Get the value of description
327
     */
328
    public function getDescription()
329
    {
330
        return $this->description;
331
    }
332
333
    /**
334
     * Set the value of description
335
     */
336
    public function setDescription($description): self
337
    {
338
        $this->description = $description;
339
340
        return $this;
341
    }
342
343
    /**
344
     * Get the value of queue
345
     */
346
    public function getQueue(): Queue
347
    {
348
        return $this->queue;
349
    }
350
351
    /**
352
     * Set the value of queue
353
     */
354
    public function setQueue(Queue $queue): self
355
    {
356
        $this->queue = $queue;
357
358
        return $this;
359
    }
360
}
361