Passed
Push — master ( 95a4b8...3a574b )
by Luiz Kim
03:30 queued 01:39
created

ProductGroupProducts::setProductChild()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

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