Passed
Push — master ( b07450...7ffb1d )
by Luiz Kim
03:46 queued 01:43
created

OrderProduct::setId()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 2
c 1
b 0
f 0
nc 1
nop 1
dl 0
loc 5
rs 10
1
<?php
2
3
namespace App\Entity;
4
5
6
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...
7
use Doctrine\Common\Collections\ArrayCollection;
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\ArrayCollection 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...
8
use ApiPlatform\Core\Annotation\ApiSubresource;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Core\Annotation\ApiSubresource 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 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...
10
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...
11
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...
12
use ApiPlatform\Doctrine\Orm\Filter\OrderFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\OrderFilter 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 ControleOnline\Entity\SalesOrderInvoice;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\SalesOrderInvoice 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 stdClass;
15
use ApiPlatform\Doctrine\Orm\Filter\DateFilter;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Doctrine\Orm\Filter\DateFilter 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\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...
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\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...
19
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...
20
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...
21
use ApiPlatform\Metadata\ApiProperty;
0 ignored issues
show
Bug introduced by
The type ApiPlatform\Metadata\ApiProperty 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(
26
            security: 'is_granted(\'ROLE_CLIENT\')',
27
        ),
28
        new GetCollection(
29
            security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')',
30
        ),
31
        new Post(
32
            security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')',
33
            validationContext: ['groups' => ['order_product_write']],
34
            denormalizationContext: ['groups' => ['order_product_write']]
35
        ),
36
        new Put(
37
            security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))',
38
            validationContext: ['groups' => ['order_product_write']],
39
            denormalizationContext: ['groups' => ['order_product_write']]
40
        ),
41
    ],
42
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
43
    normalizationContext: ['groups' => ['order_product_read']],
44
    denormalizationContext: ['groups' => ['order_product_write']]
45
)]
46
#[ApiFilter(filterClass: OrderFilter::class, properties: ['alterDate' => 'DESC'])]
47
48
class OrderProduct
49
{
50
    /**
51
     * @ORM\Id
52
     * @ORM\GeneratedValue
53
     * @ORM\Column(type="integer")
54
     * @Groups({"order_read","order_product_write","order_product_read"})
55
     */
56
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
57
    private $id;
58
59
    /**
60
     * @ORM\ManyToOne(targetEntity="App\Entity\Order")
61
     * @ORM\JoinColumn(nullable=false)
62
     * @Groups({"order_read","order_product_write","order_product_read"})
63
     */
64
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
65
    private $order;
66
67
    /**
68
     * @ORM\ManyToOne(targetEntity="App\Entity\Product")
69
     * @ORM\JoinColumn(nullable=false)
70
     * @Groups({"order_read","order_product_write","order_product_read"})
71
     */
72
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
73
    private $product;
74
75
    /**
76
     * @ORM\Column(type="float")
77
     * @Groups({"order_read","order_product_write","order_product_read"})
78
     */
79
    private $quantity;
80
81
    /**
82
     * @ORM\Column(type="float")
83
     * @Groups({"order_read","order_product_write","order_product_read"})
84
     */
85
    private $price;
86
87
    /**
88
     * @ORM\Column(type="float")
89
     * @Groups({"order_read","order_product_write","order_product_read"})
90
     */
91
    private $total;
92
93
    // Getters and setters
94
95
    /**
96
     * Get the value of id
97
     */
98
    public function getId()
99
    {
100
        return $this->id;
101
    }
102
103
    /**
104
     * Set the value of id
105
     */
106
    public function setId($id): self
107
    {
108
        $this->id = $id;
109
110
        return $this;
111
    }
112
113
    /**
114
     * Get the value of order
115
     */
116
    public function getOrder()
117
    {
118
        return $this->order;
119
    }
120
121
    /**
122
     * Set the value of order
123
     */
124
    public function setOrder($order): self
125
    {
126
        $this->order = $order;
127
128
        return $this;
129
    }
130
131
    /**
132
     * Get the value of product
133
     */
134
    public function getProduct()
135
    {
136
        return $this->product;
137
    }
138
139
    /**
140
     * Set the value of product
141
     */
142
    public function setProduct($product): self
143
    {
144
        $this->product = $product;
145
146
        return $this;
147
    }
148
149
    /**
150
     * Get the value of quantity
151
     */
152
    public function getQuantity()
153
    {
154
        return $this->quantity;
155
    }
156
157
    /**
158
     * Set the value of quantity
159
     */
160
    public function setQuantity($quantity): self
161
    {
162
        $this->quantity = $quantity;
163
164
        return $this;
165
    }
166
167
    /**
168
     * Get the value of price
169
     */
170
    public function getPrice()
171
    {
172
        return $this->price;
173
    }
174
175
    /**
176
     * Set the value of price
177
     */
178
    public function setPrice($price): self
179
    {
180
        $this->price = $price;
181
182
        return $this;
183
    }
184
185
    /**
186
     * Get the value of total
187
     */
188
    public function getTotal()
189
    {
190
        return $this->total;
191
    }
192
193
    /**
194
     * Set the value of total
195
     */
196
    public function setTotal($total): self
197
    {
198
        $this->total = $total;
199
200
        return $this;
201
    }
202
}
203