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

Order::addAOrderQueue()   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 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 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...
7
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...
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\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...
10
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...
11
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...
12
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...
13
use stdClass;
14
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...
15
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...
16
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...
17
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...
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\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...
21
use App\Entity\OrderProduct;
22
23
/**
24
 * SalesOrder
25
 *
26
 * @ORM\EntityListeners({App\Listener\LogListener::class})
27
 * @ORM\Table(name="orders", uniqueConstraints={@ORM\UniqueConstraint(name="discount_id", columns={"discount_coupon_id"})}, indexes={@ORM\Index(name="adress_destination_id", columns={"address_destination_id"}), @ORM\Index(name="notified", columns={"notified"}), @ORM\Index(name="delivery_contact_id", columns={"delivery_contact_id"}), @ORM\Index(name="contract_id", columns={"contract_id"}), @ORM\Index(name="delivery_people_id", columns={"delivery_people_id"}), @ORM\Index(name="status_id", columns={"status_id"}), @ORM\Index(name="order_date", columns={"order_date"}), @ORM\Index(name="provider_id", columns={"provider_id"}), @ORM\Index(name="quote_id", columns={"quote_id", "provider_id"}), @ORM\Index(name="adress_origin_id", columns={"address_origin_id"}), @ORM\Index(name="retrieve_contact_id", columns={"retrieve_contact_id"}), @ORM\Index(name="main_order_id", columns={"main_order_id"}), @ORM\Index(name="retrieve_people_id", columns={"retrieve_people_id"}), @ORM\Index(name="payer_people_id", columns={"payer_people_id"}), @ORM\Index(name="client_id", columns={"client_id"}), @ORM\Index(name="alter_date", columns={"alter_date"}), @ORM\Index(name="IDX_E52FFDEEDB805178", columns={"quote_id"})})
28
 * @ORM\Entity(repositoryClass="ControleOnline\Repository\OrderRepository")
29
 */
30
31
#[ApiResource(
32
    operations: [
33
        new Get(
34
            security: 'is_granted(\'ROLE_CLIENT\')',
35
        ),
36
        new GetCollection(
37
            security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')',
38
        ),
39
        new Post(
40
            security: 'is_granted(\'ROLE_ADMIN\') or is_granted(\'ROLE_CLIENT\')',
41
            validationContext: ['groups' => ['order_write']],
42
            denormalizationContext: ['groups' => ['order_write']]
43
        ),
44
        new Put(
45
            security: 'is_granted(\'ROLE_ADMIN\') or (is_granted(\'ROLE_CLIENT\'))',
46
            validationContext: ['groups' => ['order_write']],
47
            denormalizationContext: ['groups' => ['order_write']]
48
        ),
49
    ],
50
    formats: ['jsonld', 'json', 'html', 'jsonhal', 'csv' => ['text/csv']],
51
    normalizationContext: ['groups' => ['order_read']],
52
    denormalizationContext: ['groups' => ['order_write']]
53
)]
54
#[ApiFilter(filterClass: OrderFilter::class, properties: ['alterDate' => 'DESC'])]
55
56
57
class Order
58
{
59
    /**
60
     * @var integer
61
     *
62
     * @ORM\Column(name="id", type="integer", nullable=false)
63
     * @ORM\Id
64
     * @ORM\GeneratedValue(strategy="IDENTITY")
65
     * @Groups({"order_read","company_expense_read","task_read","coupon_read","logistic_read","order_invoice_read"})
66
     */
67
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['id' => 'exact'])]
68
69
    private $id;
70
71
    /**
72
     * @var \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...
73
     *
74
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
75
     * @ORM\JoinColumns({
76
     *   @ORM\JoinColumn(name="client_id", referencedColumnName="id")
77
     * })
78
     * @Groups({"order_read","order_write", "invoice_read", "task_read"})
79
     */
80
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['client' => 'exact'])]
81
82
    private $client;
83
84
    /**
85
     * @var \DateTimeInterface
86
     * @ORM\Column(name="order_date", type="datetime",  nullable=false, columnDefinition="DATETIME")
87
     * @Groups({"order_read","order_write"})
88
     */
89
    #[ApiFilter(DateFilter::class, properties: ['orderDate'])]
90
91
    private $orderDate;
92
93
    /**
94
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderProduct", mappedBy="order", cascade={"persist"})
95
     * @Groups({"order_read","order_write"})
96
     */
97
    private $orderProducts;
98
99
    /**
100
     * @var \Doctrine\Common\Collections\Collection
0 ignored issues
show
Bug introduced by
The type Doctrine\Common\Collections\Collection 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...
101
     *
102
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\SalesOrderInvoice", mappedBy="order")
103
     */
104
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoice' => 'exact'])]
105
106
    private $invoice;
107
108
    /**
109
     * @var \Doctrine\Common\Collections\Collection
110
     *
111
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Task", mappedBy="order")
112
     */
113
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['task' => 'exact'])]
114
115
    private $task;
116
117
    /**
118
     * @var \Doctrine\Common\Collections\Collection
119
     *
120
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\SalesOrderInvoiceTax", mappedBy="order")
121
     */
122
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoiceTax' => 'exact'])]
123
124
    private $invoiceTax;
125
126
    /**
127
     * @ORM\Column(name="alter_date", type="datetime",  nullable=false)
128
     * @Groups({"display_read","order_read","order_write"})
129
     */
130
131
    #[ApiFilter(DateFilter::class, properties: ['alterDate'])]
132
133
    private $alterDate;
134
135
136
    /**
137
     * @var \ControleOnline\Entity\Status
138
     *
139
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status")
140
     * @ORM\JoinColumns({
141
     *   @ORM\JoinColumn(name="status_id", referencedColumnName="id")
142
     * })
143
     * @Groups({"display_read","order_read","order_write"})
144
     */
145
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])]
146
147
    private $status;
148
149
    /**
150
     * @var string
151
     *
152
     * @ORM\Column(name="order_type", type="string",  nullable=true)
153
     * @Groups({"display_read","order_read","order_write"})
154
     */
155
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderType' => 'exact'])]
156
157
    private $orderType = 'Online';
158
159
160
    /**
161
     * @var string
162
     *
163
     * @ORM\Column(name="app", type="string",  nullable=true)
164
     * @Groups({"display_read","order_read","order_write"}) 
165
     */
166
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['app' => 'exact'])]
167
168
    private $app = 'Manual';
169
170
    /**
171
     * @var string
172
     *
173
     * @ORM\Column(name="other_informations", type="json",  nullable=true)
174
     * @Groups({"order_read","order_write"}) 
175
     */
176
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['otherInformations' => 'exact'])]
177
178
    private $otherInformations;
179
180
    /**
181
     * @var \ControleOnline\Entity\SalesOrder
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\SalesOrder 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...
182
     *
183
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\SalesOrder")
184
     * @ORM\JoinColumns({
185
     *   @ORM\JoinColumn(name="main_order_id", referencedColumnName="id")
186
     * })
187
     */
188
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrder' => 'exact'])]
189
190
    private $mainOrder;
191
192
193
    /**
194
     * @var integer
195
     *
196
     * @ORM\Column(name="main_order_id", type="integer",  nullable=true)
197
     * @Groups({"order_read","order_write"})
198
     */
199
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrderId' => 'exact'])]
200
201
    private $mainOrderId;
202
203
    /**
204
     * @var \ControleOnline\Entity\Contract
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Contract 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...
205
     *
206
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Contract")
207
     * @ORM\JoinColumns({
208
     *   @ORM\JoinColumn(name="contract_id", referencedColumnName="id")
209
     * })
210
     * @Groups({"order_read","order_write","task_read","logistic_read"}) 
211
     */
212
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['contract' => 'exact'])]
213
214
    private $contract;
215
216
    /**
217
     * @var \ControleOnline\Entity\People
218
     *
219
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
220
     * @ORM\JoinColumns({
221
     *   @ORM\JoinColumn(name="payer_people_id", referencedColumnName="id")
222
     * })
223
     * @Groups({"order_read","order_write","task_read","invoice_read"})
224
     */
225
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['payer' => 'exact'])]
226
227
    private $payer;
228
229
    /**
230
     * @var \ControleOnline\Entity\People
231
     *
232
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
233
     * @ORM\JoinColumns({
234
     *   @ORM\JoinColumn(name="provider_id", referencedColumnName="id")
235
     * })
236
     * @Groups({"order_read","order_write","invoice_read", "task_read"})
237
     */
238
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['provider' => 'exact'])]
239
240
    private $provider;
241
242
    /**
243
     * @var \ControleOnline\Entity\Quotation
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Quotation 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...
244
     *
245
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Quotation")
246
     * @ORM\JoinColumns({
247
     *   @ORM\JoinColumn(name="quote_id", referencedColumnName="id")
248
     * })
249
     * @Groups({"order_read","order_write"})
250
     */
251
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['quote' => 'exact'])]
252
253
    private $quote;
254
255
    /**
256
     * @var \Doctrine\Common\Collections\Collection
257
     *
258
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Quotation", mappedBy="order")
259
     */
260
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['quotes' => 'exact'])]
261
262
    private $quotes;
263
264
    /**
265
     * @var \Doctrine\Common\Collections\Collection
266
     *
267
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Retrieve", mappedBy="order")
268
     */
269
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieves' => 'exact'])]
270
271
    private $retrieves;
272
273
    /**
274
     * @var \ControleOnline\Entity\Address
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Address 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...
275
     *
276
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address")
277
     * @ORM\JoinColumns({
278
     *   @ORM\JoinColumn(name="address_origin_id", referencedColumnName="id")
279
     * })
280
     */
281
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])]
282
283
    private $addressOrigin;
284
285
    /**
286
     * @var \ControleOnline\Entity\Address
287
     *
288
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address")
289
     * @ORM\JoinColumns({
290
     *   @ORM\JoinColumn(name="address_destination_id", referencedColumnName="id")
291
     * })
292
     */
293
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])]
294
295
    private $addressDestination;
296
297
    /**
298
     * @var \ControleOnline\Entity\People
299
     *
300
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
301
     * @ORM\JoinColumns({
302
     *   @ORM\JoinColumn(name="retrieve_contact_id", referencedColumnName="id")
303
     * })
304
     */
305
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])]
306
307
    private $retrieveContact;
308
309
    /**
310
     * @var \ControleOnline\Entity\People
311
     *
312
     * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People")
313
     * @ORM\JoinColumns({
314
     *   @ORM\JoinColumn(name="delivery_contact_id", referencedColumnName="id")
315
     * })
316
     */
317
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])]
318
319
    private $deliveryContact;
320
321
    /**
322
     * @var \Doctrine\Common\Collections\Collection
323
     *
324
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderPackage", mappedBy="order")
325
     */
326
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderPackage' => 'exact'])]
327
328
    private $orderPackage;
329
330
    /**
331
     * @var float
332
     *
333
     * @ORM\Column(name="price", type="float",  nullable=false)
334
     * @Groups({"order_read","order_write"})
335
     */
336
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])]
337
338
    private $price = 0;
339
340
341
342
    /**
343
     * @var string
344
     *
345
     * @ORM\Column(name="comments", type="string",  nullable=true)
346
     * @Groups({"order_read","order_write"})
347
     */
348
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])]
349
350
    private $comments;
351
352
    /**
353
     * @var boolean
354
     *
355
     * @ORM\Column(name="notified", type="boolean")
356
     */
357
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])]
358
359
    private $notified = false;
360
361
    /**
362
     * @var \Doctrine\Common\Collections\Collection
363
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderTracking", mappedBy="order")
364
     * @ApiSubresource()
365
     */
366
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['tracking' => 'exact'])]
367
368
    private $tracking;
369
370
371
372
    /**
373
     * @var \Doctrine\Common\Collections\Collection
374
     *
375
     * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderQueue", mappedBy="order")
376
     * @Groups({"order_read","order_write"}) 
377
     */
378
    #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderQueue' => 'exact'])]
379
380
    private $orderQueue;
381
382
383
384
    public function __construct()
385
    {
386
        $this->orderDate    = new \DateTime('now');
387
        $this->alterDate    = new \DateTime('now');
388
        $this->orderPackage = new ArrayCollection();
389
        $this->invoiceTax   = new ArrayCollection();
390
        $this->invoice      = new ArrayCollection();
391
        $this->quotes       = new ArrayCollection();
392
        $this->retrieves    = new ArrayCollection();
393
        $this->tracking     = new ArrayCollection();
394
        $this->task         = new ArrayCollection();
395
        $this->orderQueue   = new ArrayCollection();
396
        $this->orderProducts = new ArrayCollection();
397
        // $this->parkingDate  = new \DateTime('now');
398
        $this->otherInformations = json_encode(new stdClass());
399
    }
400
401
    public function resetId()
402
    {
403
        $this->id          = null;
404
        $this->orderDate   = new \DateTime('now');
405
        $this->alterDate   = new \DateTime('now');
406
        // $this->parkingDate = new \DateTime('now');
407
    }
408
409
    /**
410
     * Get id
411
     *
412
     * @return integer
413
     */
414
    public function getId()
415
    {
416
        return $this->id;
417
    }
418
419
    /**
420
     * Set status
421
     *
422
     * @param \ControleOnline\Entity\Status $status
423
     * @return Order
424
     */
425
    public function setStatus(\ControleOnline\Entity\Status $status = null)
426
    {
427
        $this->status = $status;
428
429
        return $this;
430
    }
431
432
    /**
433
     * Get status
434
     *
435
     * @return \ControleOnline\Entity\Status
436
     */
437
    public function getStatus()
438
    {
439
        return $this->status;
440
    }
441
442
    /**
443
     * Set client
444
     *
445
     * @param \ControleOnline\Entity\People $client
446
     * @return Order
447
     */
448
    public function setClient(\ControleOnline\Entity\People $client = null)
449
    {
450
        $this->client = $client;
451
452
        return $this;
453
    }
454
455
    /**
456
     * Get client
457
     *
458
     * @return \ControleOnline\Entity\People
459
     */
460
    public function getClient()
461
    {
462
        return $this->client;
463
    }
464
465
    /**
466
     * Set provider
467
     *
468
     * @param \ControleOnline\Entity\People $provider
469
     * @return Order
470
     */
471
    public function setProvider(\ControleOnline\Entity\People $provider = null)
472
    {
473
        $this->provider = $provider;
474
475
        return $this;
476
    }
477
478
    /**
479
     * Get provider
480
     *
481
     * @return \ControleOnline\Entity\People
482
     */
483
    public function getProvider()
484
    {
485
        return $this->provider;
486
    }
487
488
    /**
489
     * Set price
490
     *
491
     * @param float $price
492
     * @return Order
493
     */
494
    public function setPrice($price)
495
    {
496
        $this->price = $price;
497
498
        return $this;
499
    }
500
501
    /**
502
     * Get price
503
     *
504
     * @return float
505
     */
506
    public function getPrice()
507
    {
508
        return $this->price;
509
    }
510
511
    /**
512
     * Set quote
513
     *
514
     * @param \ControleOnline\Entity\Quotation $quote
515
     * @return Order
516
     */
517
    public function setQuote(\ControleOnline\Entity\Quotation $quote = null)
518
    {
519
        $this->quote = $quote;
520
521
        return $this;
522
    }
523
524
    /**
525
     * Get quote
526
     *
527
     * @return \ControleOnline\Entity\Quotation
528
     */
529
    public function getQuote()
530
    {
531
        return $this->quote;
532
    }
533
534
    /**
535
     * Set addressOrigin
536
     *
537
     * @param \ControleOnline\Entity\Address $address_origin
538
     * @return Order
539
     */
540
    public function setAddressOrigin(\ControleOnline\Entity\Address $address_origin = null)
541
    {
542
        $this->addressOrigin = $address_origin;
543
544
        return $this;
545
    }
546
547
    /**
548
     * Get addressOrigin
549
     *
550
     * @return \ControleOnline\Entity\Address
551
     */
552
    public function getAddressOrigin()
553
    {
554
        return $this->addressOrigin;
555
    }
556
557
    /**
558
     * Set addressDestination
559
     *
560
     * @param \ControleOnline\Entity\Address $address_destination
561
     * @return Order
562
     */
563
    public function setAddressDestination(\ControleOnline\Entity\Address $address_destination = null)
564
    {
565
        $this->addressDestination = $address_destination;
566
567
        return $this;
568
    }
569
570
    /**
571
     * Get quote
572
     *
573
     * @return \ControleOnline\Entity\Address
574
     */
575
    public function getAddressDestination()
576
    {
577
        return $this->addressDestination;
578
    }
579
580
    /**
581
     * Get retrieveContact
582
     *
583
     * @return \ControleOnline\Entity\People
584
     */
585
    public function getRetrieveContact()
586
    {
587
        return $this->retrieveContact;
588
    }
589
590
    /**
591
     * Set retrieveContact
592
     *
593
     * @param \ControleOnline\Entity\People $retrieve_contact
594
     * @return Order
595
     */
596
    public function setRetrieveContact(\ControleOnline\Entity\People $retrieve_contact = null)
597
    {
598
        $this->retrieveContact = $retrieve_contact;
599
600
        return $this;
601
    }
602
603
    /**
604
     * Get deliveryContact
605
     *
606
     * @return \ControleOnline\Entity\People
607
     */
608
    public function getDeliveryContact()
609
    {
610
        return $this->deliveryContact;
611
    }
612
613
    /**
614
     * Set deliveryContact
615
     *
616
     * @param \ControleOnline\Entity\People $delivery_contact
617
     * @return Order
618
     */
619
    public function setDeliveryContact(\ControleOnline\Entity\People $delivery_contact = null)
620
    {
621
        $this->deliveryContact = $delivery_contact;
622
623
        return $this;
624
    }
625
626
    /**
627
     * Set payer
628
     *
629
     * @param \ControleOnline\Entity\People $payer
630
     * @return Order
631
     */
632
    public function setPayer(\ControleOnline\Entity\People $payer = null)
633
    {
634
        $this->payer = $payer;
635
636
        return $this;
637
    }
638
639
    /**
640
     * Get payer
641
     *
642
     * @return \ControleOnline\Entity\People
643
     */
644
    public function getPayer()
645
    {
646
        return $this->payer;
647
    }
648
649
650
    /**
651
     * Set comments
652
     *
653
     * @param string $comments
654
     * @return Order
655
     */
656
    public function setComments($comments)
657
    {
658
        $this->comments = $comments;
659
660
        return $this;
661
    }
662
663
    /**
664
     * Get comments
665
     *
666
     * @return string
667
     */
668
    public function getComments()
669
    {
670
        return $this->comments;
671
    }
672
673
    /**
674
     * Get otherInformations
675
     *
676
     * @return stdClass
677
     */
678
    public function getOtherInformations($decode = false)
679
    {
680
        return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations;
0 ignored issues
show
introduced by
The condition is_array($this->otherInformations) is always false.
Loading history...
Bug Best Practice introduced by
The expression return $decode ? (object...this->otherInformations also could return the type string which is incompatible with the documented return type stdClass.
Loading history...
681
    }
682
683
    /**
684
     * Set comments
685
     *
686
     * @param string $otherInformations
687
     * @return Order
688
     */
689
    public function addOtherInformations($key, $value)
690
    {
691
        $otherInformations = $this->getOtherInformations(true);
692
        $otherInformations->$key = $value;
693
        $this->otherInformations = json_encode($otherInformations);
694
        return $this;
695
    }
696
697
    /**
698
     * Set comments
699
     *
700
     * @param string $otherInformations
701
     * @return Order
702
     */
703
    public function setOtherInformations($otherInformations)
704
    {
705
        $this->otherInformations = json_encode($otherInformations);
706
        return $this;
707
    }
708
709
710
    /**
711
     * Get orderDate
712
     *
713
     * @return \DateTimeInterface
714
     */
715
    public function getOrderDate()
716
    {
717
        return $this->orderDate;
718
    }
719
720
    /**
721
     * Set alter_date
722
     *
723
     * @param \DateTimeInterface $alter_date
724
     */
725
    public function setAlterDate(\DateTimeInterface $alter_date = null): self
726
    {
727
        $this->alterDate = $alter_date;
728
729
        return $this;
730
    }
731
732
    /**
733
     * Get alter_date
734
     *
735
     */
736
    public function getAlterDate(): ?\DateTimeInterface
737
    {
738
        return $this->alterDate;
739
    }
740
741
    /**
742
     * Add orderPackage
743
     *
744
     * @param \ControleOnline\Entity\OrderPackage $order_package
745
     * @return Order
746
     */
747
    public function addOrderPackage(\ControleOnline\Entity\OrderPackage $order_package)
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\OrderPackage 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...
748
    {
749
        $this->orderPackage[] = $order_package;
750
751
        return $this;
752
    }
753
754
    /**
755
     * Remove orderPackage
756
     *
757
     * @param \ControleOnline\Entity\OrderPackage $order_package
758
     */
759
    public function removeOrderPackage(\ControleOnline\Entity\OrderPackage $order_package)
760
    {
761
        $this->orderPackage->removeElement($order_package);
762
    }
763
764
    /**
765
     * Get orderPackage
766
     *
767
     * @return \Doctrine\Common\Collections\Collection
768
     */
769
    public function getOrderPackage()
770
    {
771
        return $this->orderPackage;
772
    }
773
774
    /**
775
     * Add invoiceTax
776
     *
777
     * @param \ControleOnline\Entity\SalesOrderInvoiceTax $invoice_tax
778
     * @return Order
779
     */
780
    public function addAInvoiceTax(SalesOrderInvoiceTax $invoice_tax)
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\SalesOrderInvoiceTax 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...
781
    {
782
        $this->invoiceTax[] = $invoice_tax;
783
784
        return $this;
785
    }
786
787
    /**
788
     * Remove invoiceTax
789
     *
790
     * @param \ControleOnline\Entity\SalesOrderInvoiceTax $invoice_tax
791
     */
792
    public function removeInvoiceTax(SalesOrderInvoiceTax $invoice_tax)
793
    {
794
        $this->invoiceTax->removeElement($invoice_tax);
795
    }
796
797
    /**
798
     * Get invoiceTax
799
     *
800
     * @return \Doctrine\Common\Collections\Collection
801
     */
802
    public function getInvoiceTax()
803
    {
804
        return $this->invoiceTax;
805
    }
806
807
808
809
    /**
810
     * Get invoiceTax
811
     *
812
     * @return \ControleOnline\Entity\SalesInvoiceTax
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\SalesInvoiceTax 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...
813
     */
814
    public function getClientSalesInvoiceTax()
815
    {
816
        foreach ($this->getInvoiceTax() as $invoice) {
817
            if ($invoice->getInvoiceType() == 55) {
818
                return $invoice;
819
            }
820
        }
821
    }
822
823
    /**
824
     * Get invoiceTax
825
     *
826
     * @return \ControleOnline\Entity\SalesInvoiceTax
827
     */
828
    public function getClientInvoiceTax()
829
    {
830
        foreach ($this->getInvoiceTax() as $invoice) {
831
            if ($invoice->getInvoiceType() == 55) {
832
                return $invoice->getInvoiceTax();
833
            }
834
        }
835
    }
836
    /**
837
     * Get invoiceTax
838
     *
839
     * @return \ControleOnline\Entity\SalesInvoiceTax
840
     */
841
    public function getCarrierInvoiceTax()
842
    {
843
        foreach ($this->getInvoiceTax() as $invoice) {
844
            if ($invoice->getInvoiceType() == 57) {
845
                return $invoice->getInvoiceTax();
846
            }
847
        }
848
    }
849
850
    /**
851
     * Add SalesOrderInvoice
852
     *
853
     * @param \ControleOnline\Entity\SalesOrderInvoice $invoice
854
     * @return People
855
     */
856
    public function addInvoice(SalesOrderInvoice $invoice)
857
    {
858
        $this->invoice[] = $invoice;
859
860
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Order which is incompatible with the documented return type ControleOnline\Entity\People.
Loading history...
861
    }
862
863
    /**
864
     * Remove SalesOrderInvoice
865
     *
866
     * @param \ControleOnline\Entity\SalesOrderInvoice $invoice
867
     */
868
    public function removeInvoice(SalesOrderInvoice $invoice)
869
    {
870
        $this->invoice->removeElement($invoice);
871
    }
872
873
    /**
874
     * Get SalesOrderInvoice
875
     *
876
     * @return \Doctrine\Common\Collections\Collection
877
     */
878
    public function getInvoice()
879
    {
880
        return $this->invoice;
881
    }
882
883
    /**
884
     * Add quotes
885
     *
886
     * @param \ControleOnline\Entity\Quotation $quotes
887
     * @return Order
888
     */
889
    public function addAQuotes(\ControleOnline\Entity\Quotation $quotes)
890
    {
891
        $this->quotes[] = $quotes;
892
893
        return $this;
894
    }
895
896
    /**
897
     * Remove quotes
898
     *
899
     * @param \ControleOnline\Entity\Quotation $quotes
900
     */
901
    public function removeQuotes(\ControleOnline\Entity\Quotation $quotes)
902
    {
903
        $this->quotes->removeElement($quotes);
904
    }
905
906
    /**
907
     * Get quotes
908
     *
909
     * @return \Doctrine\Common\Collections\Collection
910
     */
911
    public function getQuotes()
912
    {
913
        return $this->quotes;
914
    }
915
916
    /**
917
     * Add retrieves
918
     *
919
     * @param \ControleOnline\Entity\Retrieve $retrieves
920
     * @return Order
921
     */
922
    public function addARetrieves(\ControleOnline\Entity\Retrieve $retrieves)
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Retrieve 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...
923
    {
924
        $this->retrieves[] = $retrieves;
925
926
        return $this;
927
    }
928
929
    /**
930
     * Remove retrieves
931
     *
932
     * @param \ControleOnline\Entity\Retrieve $retrieves
933
     */
934
    public function removeRetrieves(\ControleOnline\Entity\Retrieve $retrieves)
935
    {
936
        $this->retrieves->removeElement($retrieves);
937
    }
938
939
    /**
940
     * Get retrieves
941
     *
942
     * @return \Doctrine\Common\Collections\Collection
943
     */
944
    public function getRetrieves()
945
    {
946
        return $this->retrieves;
947
    }
948
949
    /**
950
     * Get Notified
951
     *
952
     * @return boolean
953
     */
954
    public function getNotified()
955
    {
956
        return $this->notified;
957
    }
958
959
    /**
960
     * Set Notified
961
     *
962
     * @param boolean $notified
963
     * @return People
964
     */
965
    public function setNotified($notified)
966
    {
967
        $this->notified = $notified ? 1 : 0;
0 ignored issues
show
Documentation Bug introduced by
The property $notified was declared of type boolean, but $notified ? 1 : 0 is of type integer. Maybe add a type cast?

This check looks for assignments to scalar types that may be of the wrong type.

To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.

$answer = 42;

$correct = false;

$correct = (bool) $answer;
Loading history...
968
969
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Order which is incompatible with the documented return type ControleOnline\Entity\People.
Loading history...
970
    }
971
972
    /**
973
     * Set orderType
974
     *
975
     * @param string $orderType
976
     * @return Order
977
     */
978
    public function setOrderType($order_type)
979
    {
980
        $this->orderType = $order_type;
981
982
        return $this;
983
    }
984
985
    /**
986
     * Get orderType
987
     *
988
     * @return string
989
     */
990
    public function getOrderType()
991
    {
992
        return $this->orderType;
993
    }
994
995
    /**
996
     * Set app
997
     *
998
     * @param string $app
999
     * @return Order
1000
     */
1001
    public function setApp($app)
1002
    {
1003
        $this->app = $app;
1004
1005
        return $this;
1006
    }
1007
1008
    /**
1009
     * Get app
1010
     *
1011
     * @return string
1012
     */
1013
    public function getApp()
1014
    {
1015
        return $this->app;
1016
    }
1017
1018
1019
1020
    /**
1021
     * Set mainOrder
1022
     *
1023
     * @param \ControleOnline\Entity\SalesOrder $mainOrder
1024
     * @return Order
1025
     */
1026
    public function setMainOrder(\ControleOnline\Entity\SalesOrder $main_order = null)
1027
    {
1028
        $this->mainOrder = $main_order;
1029
1030
        return $this;
1031
    }
1032
1033
    /**
1034
     * Get mainOrder
1035
     *
1036
     * @return \ControleOnline\Entity\SalesOrder
1037
     */
1038
    public function getMainOrder()
1039
    {
1040
        return $this->mainOrder;
1041
    }
1042
1043
    /**
1044
     * Set mainOrderId
1045
     *
1046
     * @param integer $mainOrderId
1047
     * @return Order
1048
     */
1049
    public function setMainOrderId($mainOrderId)
1050
    {
1051
        $this->mainOrderId = $mainOrderId;
1052
1053
        return $this;
1054
    }
1055
1056
    /**
1057
     * Get mainOrderId
1058
     *
1059
     * @return integer
1060
     */
1061
    public function getMainOrderId()
1062
    {
1063
        return $this->mainOrderId;
1064
    }
1065
1066
    /**
1067
     * Set contract
1068
     *
1069
     * @param \ControleOnline\Entity\Contract $contract
1070
     * @return SalesOrder
1071
     */
1072
    public function setContract($contract)
1073
    {
1074
        $this->contract = $contract;
1075
1076
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Order which is incompatible with the documented return type ControleOnline\Entity\SalesOrder.
Loading history...
1077
    }
1078
1079
    public function getInvoiceByStatus(array $status)
1080
    {
1081
        foreach ($this->getInvoice() as $purchasingOrderInvoice) {
1082
            $invoice = $purchasingOrderInvoice->getInvoice();
1083
            if (in_array($invoice->getStatus()->getStatus(), $status)) {
1084
                return $invoice;
1085
            }
1086
        }
1087
    }
1088
    /**
1089
     * Get contract
1090
     *
1091
     * @return \ControleOnline\Entity\Contract
1092
     */
1093
    public function getContract()
1094
    {
1095
        return $this->contract;
1096
    }
1097
1098
    public function canAccess($currentUser): bool
1099
    {
1100
        if (($provider = $this->getProvider()) === null)
1101
            return false;
1102
1103
        return $currentUser->getPeople()->getLink()->exists(
1104
            function ($key, $element) use ($provider) {
1105
                return $element->getCompany() === $provider;
1106
            }
1107
        );
1108
    }
1109
1110
    public function justOpened(): bool
1111
    {
1112
        return $this->getStatus()->getStatus() == 'quote';
1113
    }
1114
1115
    /**
1116
     * Get tracking
1117
     *
1118
     * @return \Doctrine\Common\Collections\Collection
1119
     */
1120
    public function getTracking()
1121
    {
1122
        return $this->tracking;
1123
    }
1124
1125
    public function getOneInvoice()
1126
    {
1127
        return (($invoiceOrders = $this->getInvoice()->first()) === false) ?
1128
            null : $invoiceOrders->getInvoice();
1129
    }
1130
1131
    /**
1132
     * Add Task
1133
     *
1134
     * @param \ControleOnline\Entity\Task $task
1135
     * @return SalesOrder
1136
     */
1137
    public function addTask(\ControleOnline\Entity\Task $task)
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\Task 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...
1138
    {
1139
        $this->task[] = $task;
1140
1141
        return $this;
0 ignored issues
show
Bug Best Practice introduced by
The expression return $this returns the type ControleOnline\Entity\Order which is incompatible with the documented return type ControleOnline\Entity\SalesOrder.
Loading history...
1142
    }
1143
1144
    /**
1145
     * Remove Task
1146
     *
1147
     * @param \ControleOnline\Entity\Task $task
1148
     */
1149
    public function removeTask(\ControleOnline\Entity\Task $task)
1150
    {
1151
        $this->task->removeElement($task);
1152
    }
1153
1154
    /**
1155
     * Get Task
1156
     *
1157
     * @return \Doctrine\Common\Collections\Collection
1158
     */
1159
    public function getTask()
1160
    {
1161
        return $this->task;
1162
    }
1163
1164
    /**
1165
     * Add OrderQueue
1166
     *
1167
     * @param \ControleOnline\Entity\OrderQueue $invoice_tax
1168
     * @return Order
1169
     */
1170
    public function addAOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue)
0 ignored issues
show
Bug introduced by
The type ControleOnline\Entity\OrderQueue 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...
1171
    {
1172
        $this->orderQueue[] = $orderQueue;
1173
1174
        return $this;
1175
    }
1176
1177
    /**
1178
     * Remove OrderQueue
1179
     *
1180
     * @param \ControleOnline\Entity\OrderQueue $invoice_tax
1181
     */
1182
    public function removeOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue)
1183
    {
1184
        $this->orderQueue->removeElement($orderQueue);
1185
    }
1186
1187
    /**
1188
     * Get OrderQueue
1189
     *
1190
     * @return \Doctrine\Common\Collections\Collection
1191
     */
1192
    public function getOrderQueue()
1193
    {
1194
        return $this->orderQueue;
1195
    }
1196
1197
    public function isOriginAndDestinationTheSame(): ?bool
1198
    {
1199
        if (($origin = $this->getAddressOrigin()) === null) {
1200
            return null;
1201
        }
1202
1203
        if (($destination = $this->getAddressDestination()) === null) {
1204
            return null;
1205
        }
1206
1207
        $origCity = $origin->getStreet()->getDistrict()->getCity();
1208
        $destCity = $destination->getStreet()->getDistrict()->getCity();
1209
1210
        // both objects are the same entity ( = same name and same state)
1211
1212
        if ($origCity === $destCity) {
1213
            return true;
1214
        }
1215
1216
        return false;
1217
    }
1218
1219
    public function isOriginAndDestinationTheSameState(): ?bool
1220
    {
1221
        if (($origin = $this->getAddressOrigin()) === null) {
1222
            return null;
1223
        }
1224
1225
        if (($destination = $this->getAddressDestination()) === null) {
1226
            return null;
1227
        }
1228
1229
        $origState = $origin->getStreet()->getDistrict()->getCity()->getState();
1230
        $destState = $destination->getStreet()->getDistrict()->getCity()->getState();
1231
1232
        // both objects are the same entity ( = same name and same country)
1233
1234
        if ($origState === $destState) {
1235
            return true;
1236
        }
1237
1238
        return false;
1239
    }
1240
1241
1242
    public function getOrderProducts()
1243
    {
1244
        return $this->orderProducts;
1245
    }
1246
1247
    public function addOrderProduct(OrderProduct $orderProduct): self
1248
    {
1249
        $this->orderProducts[] = $orderProduct;
1250
        return $this;
1251
    }
1252
1253
    public function removeOrderProduct(OrderProduct $orderProduct): self
1254
    {
1255
        $this->orderProducts->removeElement($orderProduct);
1256
        return $this;
1257
    }
1258
}
1259