OrderLogistic::getDestinationAddress()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
eloc 1
dl 0
loc 3
rs 10
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
namespace ControleOnline\Entity;
3
4
use Symfony\Component\Serializer\Attribute\Groups;
0 ignored issues
show
Bug introduced by
The type Symfony\Component\Serializer\Attribute\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...
5
6
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...
7
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...
8
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...
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\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...
12
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...
13
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...
14
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...
15
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...
16
use ControleOnline\Entity\Category;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Category 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 ControleOnline\Entity\City;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\City 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 ControleOnline\Entity\Order;
19
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...
20
use ControleOnline\Entity\Status;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Status 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 ControleOnline\Repository\OrderLogisticRepository;
22
use ControleOnline\Listener\LogListener;
0 ignored issues
show
Bug introduced by
The type ControleOnline\Listener\LogListener 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...
23
use DateTime;
24
use DateTimeInterface;
25
26
#[ORM\Table(name: 'order_logistic')]
27
#[ORM\Index(name: 'provider_id', columns: ['provider_id'])]
28
#[ORM\Index(name: 'order_id', columns: ['order_id'])]
29
#[ORM\Index(name: 'status_id', columns: ['status_id'])]
30
#[ORM\EntityListeners([LogListener::class])]
31
#[ORM\Entity(repositoryClass: OrderLogisticRepository::class)]
32
#[ApiResource(
33
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
34
    normalizationContext: ['groups' => ['logistic:read']],
35
    denormalizationContext: ['groups' => ['logistic:write']],
36
    security: "is_granted('ROLE_CLIENT')",
37
    operations: [
38
        new GetCollection(security: "is_granted('ROLE_CLIENT')"),
39
        new Get(security: "is_granted('ROLE_CLIENT')"),
40
        new Post(
41
            uriTemplate: '/order_logistics',
42
            security: "is_granted('ROLE_CLIENT')",
43
            denormalizationContext: ['groups' => ['logistic:write']]
44
        ),
45
        new Put(
46
            security: "is_granted('ROLE_CLIENT')",
47
            denormalizationContext: ['groups' => ['logistic:write']]
48
        ),
49
        new Delete(
50
            name: 'order_logistics_delete',
51
            security: "is_granted('ROLE_CLIENT')",
52
            denormalizationContext: ['groups' => ['logistic:write']]
53
        )
54
    ]
55
)]
56
#[ApiFilter(DateFilter::class, properties: [
57
    'estimatedShippingDate',
58
    'shippingDate',
59
    'estimatedArrivalDate',
60
    'arrivalDate'
61
])]
62
#[ApiFilter(SearchFilter::class, properties: [
63
    'order' => 'exact',
64
    'order.id' => 'exact',
65
    'order.contract.id' => 'exact',
66
    'order.client.name' => 'partial',
67
    'order.productType' => 'partial',
68
    'order.otherInformations' => 'partial',
69
    'originType' => 'exact',
70
    'originProvider' => 'exact',
71
    'originAddress' => 'partial',
72
    'originCity' => 'exact',
73
    'destinationType' => 'exact',
74
    'destinationProvider' => 'exact',
75
    'destinationAddress' => 'partial',
76
    'destinationCity' => 'exact',
77
    'status' => 'exact'
78
])]
79
class OrderLogistic
80
{
81
    #[ORM\Column(name: 'id', type: 'integer', nullable: false)]
82
    #[ORM\Id]
83
    #[ORM\GeneratedValue(strategy: 'IDENTITY')]
84
    #[Groups(['logistic:read'])]
85
    private $id;
86
87
    #[ORM\Column(name: 'estimated_shipping_date', type: 'date', nullable: true)]
88
    #[Groups(['logistic:read', 'logistic:write'])]
89
    private $estimatedShippingDate = null;
90
91
    #[ORM\Column(name: 'shipping_date', type: 'date', nullable: true)]
92
    #[Groups(['logistic:read', 'logistic:write'])]
93
    private $shippingDate = null;
94
95
    #[ORM\Column(name: 'estimated_arrival_date', type: 'date', nullable: true)]
96
    #[Groups(['logistic:read', 'logistic:write'])]
97
    private $estimatedArrivalDate = null;
98
99
    #[ORM\Column(name: 'arrival_date', type: 'date', nullable: true)]
100
    #[Groups(['logistic:read', 'logistic:write'])]
101
    private $arrivalDate = null;
102
103
    #[ORM\ManyToOne(targetEntity: Category::class)]
104
    #[ORM\JoinColumn(name: 'origin_type', referencedColumnName: 'id')]
105
    #[Groups(['logistic:read', 'logistic:write'])]
106
    private $originType;
107
108
    #[ORM\ManyToOne(targetEntity: City::class)]
109
    #[ORM\JoinColumn(name: 'origin_city_id', referencedColumnName: 'id')]
110
    #[Groups(['logistic:read', 'logistic:write'])]
111
    private $originCity = null;
112
113
    #[ORM\Column(name: 'origin_address', type: 'string', length: 150, nullable: true)]
114
    #[Groups(['logistic:read', 'logistic:write'])]
115
    private $originAddress = null;
116
117
    #[ORM\Column(name: 'price', type: 'float', nullable: false)]
118
    #[Groups(['logistic:read', 'logistic:write'])]
119
    private $price = 0;
120
121
    #[ORM\Column(name: 'amount_paid', type: 'float', nullable: false)]
122
    #[Groups(['logistic:read', 'logistic:write'])]
123
    private $amountPaid = 0;
124
125
    #[ORM\Column(name: 'balance', type: 'float', nullable: false)]
126
    #[Groups(['logistic:read', 'logistic:write'])]
127
    private $balance = 0;
128
129
    #[ORM\ManyToOne(targetEntity: Order::class)]
130
    #[ORM\JoinColumn(name: 'order_id', referencedColumnName: 'id')]
131
    #[Groups(['logistic:read', 'logistic:write'])]
132
    private $order;
133
134
    #[ORM\ManyToOne(targetEntity: People::class)]
135
    #[ORM\JoinColumn(name: 'origin_provider_id', referencedColumnName: 'id')]
136
    #[Groups(['logistic:read', 'logistic:write'])]
137
    private $originProvider;
138
139
    #[ORM\ManyToOne(targetEntity: Status::class)]
140
    #[ORM\JoinColumn(name: 'status_id', referencedColumnName: 'id')]
141
    #[Groups(['logistic:read', 'logistic:write'])]
142
    private $status;
143
144
    #[ORM\ManyToOne(targetEntity: Category::class)]
145
    #[ORM\JoinColumn(name: 'destination_type', referencedColumnName: 'id')]
146
    #[Groups(['logistic:read', 'logistic:write'])]
147
    private $destinationType;
148
149
    #[ORM\ManyToOne(targetEntity: City::class)]
150
    #[ORM\JoinColumn(name: 'destination_city_id', referencedColumnName: 'id')]
151
    #[Groups(['logistic:read', 'logistic:write'])]
152
    private $destinationCity = null;
153
154
    #[ORM\Column(name: 'destination_address', type: 'string', length: 150, nullable: true)]
155
    #[Groups(['logistic:read', 'logistic:write'])]
156
    private $destinationAddress = null;
157
158
    #[ORM\ManyToOne(targetEntity: People::class)]
159
    #[ORM\JoinColumn(name: 'destination_provider_id', referencedColumnName: 'id')]
160
    #[Groups(['logistic:read', 'logistic:write'])]
161
    private $destinationProvider;
162
163
    #[ORM\ManyToOne(targetEntity: People::class)]
164
    #[ORM\JoinColumn(name: 'created_by', referencedColumnName: 'id')]
165
    #[Groups(['logistic:read', 'logistic:write'])]
166
    private $created_by;
167
168
    #[ORM\Column(name: 'last_modified', type: 'datetime', nullable: false, columnDefinition: 'DATETIME')]
169
    #[Groups(['logistic:read', 'logistic:write'])]
170
    private $lastModified;
171
172
    public function getId()
173
    {
174
        return $this->id;
175
    }
176
177
    public function getEstimatedShippingDate()
178
    {
179
        return $this->estimatedShippingDate;
180
    }
181
182
    public function setEstimatedShippingDate($estimatedShippingDate)
183
    {
184
        $this->estimatedShippingDate = $estimatedShippingDate;
185
        return $this;
186
    }
187
188
    public function getShippingDate()
189
    {
190
        return $this->shippingDate;
191
    }
192
193
    public function setShippingDate($shippingDate)
194
    {
195
        $this->shippingDate = $shippingDate;
196
        return $this;
197
    }
198
199
    public function getEstimatedArrivalDate()
200
    {
201
        return $this->estimatedArrivalDate;
202
    }
203
204
    public function setEstimatedArrivalDate($estimatedArrivalDate)
205
    {
206
        $this->estimatedArrivalDate = $estimatedArrivalDate;
207
        return $this;
208
    }
209
210
    public function getArrivalDate()
211
    {
212
        return $this->arrivalDate;
213
    }
214
215
    public function setArrivalDate($arrivalDate)
216
    {
217
        $this->arrivalDate = $arrivalDate;
218
        return $this;
219
    }
220
221
    public function getOriginType()
222
    {
223
        return $this->originType;
224
    }
225
226
    public function setOriginType($originType)
227
    {
228
        $this->originType = $originType;
229
        return $this;
230
    }
231
232
    public function getOriginCity()
233
    {
234
        return $this->originCity;
235
    }
236
237
    public function setOriginCity($originCity)
238
    {
239
        $this->originCity = $originCity;
240
        return $this;
241
    }
242
243
    public function getOriginAddress()
244
    {
245
        return $this->originAddress;
246
    }
247
248
    public function setOriginAddress($originAddress)
249
    {
250
        $this->originAddress = $originAddress;
251
        return $this;
252
    }
253
254
    public function getPrice()
255
    {
256
        return $this->price;
257
    }
258
259
    public function setPrice($price)
260
    {
261
        $this->price = $price ?: 0;
262
        return $this;
263
    }
264
265
    public function getAmountPaid()
266
    {
267
        return $this->amountPaid;
268
    }
269
270
    public function setAmountPaid($amountPaid)
271
    {
272
        $this->amountPaid = $amountPaid;
273
        return $this;
274
    }
275
276
    public function getBalance()
277
    {
278
        return $this->balance;
279
    }
280
281
    public function setBalance($balance)
282
    {
283
        $this->balance = $balance;
284
        return $this;
285
    }
286
287
    public function getOrder()
288
    {
289
        return $this->order;
290
    }
291
292
    public function setOrder(Order $order)
293
    {
294
        $this->order = $order;
295
        return $this;
296
    }
297
298
    public function getOriginProvider()
299
    {
300
        return $this->originProvider;
301
    }
302
303
    public function setOriginProvider($originProvider): self
304
    {
305
        $this->originProvider = $originProvider;
306
        return $this;
307
    }
308
309
    public function getStatus()
310
    {
311
        return $this->status;
312
    }
313
314
    public function setStatus(Status $status)
315
    {
316
        $this->status = $status;
317
        return $this;
318
    }
319
320
    public function getDestinationType()
321
    {
322
        return $this->destinationType;
323
    }
324
325
    public function setDestinationType($destinationType)
326
    {
327
        $this->destinationType = $destinationType;
328
        return $this;
329
    }
330
331
    public function getDestinationCity()
332
    {
333
        return $this->destinationCity;
334
    }
335
336
    public function setDestinationCity($destinationCity)
337
    {
338
        $this->destinationCity = $destinationCity;
339
        return $this;
340
    }
341
342
    public function getDestinationAddress()
343
    {
344
        return $this->destinationAddress;
345
    }
346
347
    public function setDestinationAddress($destinationAddress)
348
    {
349
        $this->destinationAddress = $destinationAddress;
350
        return $this;
351
    }
352
353
    public function getDestinationProvider()
354
    {
355
        return $this->destinationProvider;
356
    }
357
358
    public function setDestinationProvider(?People $destinationProvider)
359
    {
360
        $this->destinationProvider = $destinationProvider;
361
        return $this;
362
    }
363
364
    public function getCreatedBy()
365
    {
366
        return $this->created_by;
367
    }
368
369
    public function setCreatedBy($created_by): self
370
    {
371
        $this->created_by = $created_by;
372
        return $this;
373
    }
374
375
    public function getLastModified()
376
    {
377
        return $this->lastModified;
378
    }
379
380
    public function setLastModified(DateTimeInterface $lastModified)
381
    {
382
        $this->lastModified = $lastModified;
383
        return $this;
384
    }
385
}