Total Complexity | 86 |
Total Lines | 1107 |
Duplicated Lines | 0 % |
Changes | 22 | ||
Bugs | 0 | Features | 0 |
Complex classes like Order often do a lot of different things. To break such a class down, we need to identify a cohesive component within that class. A common approach to find such a component is to look for fields/methods that share the same prefixes, or suffixes.
Once you have determined the fields that belong together, you can apply the Extract Class refactoring. If the component makes sense as a sub-class, Extract Subclass is also a candidate, and is often faster.
While breaking up the class, it is a good idea to analyze how other classes use Order, and based on these observations, apply Extract Interface, too.
1 | <?php |
||
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 |
||
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 |
||
101 | * |
||
102 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoice", mappedBy="order") |
||
103 | */ |
||
104 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoice' => 'exact'])] |
||
105 | private $invoice; |
||
106 | |||
107 | /** |
||
108 | * @var \Doctrine\Common\Collections\Collection |
||
109 | * |
||
110 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Task", mappedBy="order") |
||
111 | */ |
||
112 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['task' => 'exact'])] |
||
113 | |||
114 | private $task; |
||
115 | |||
116 | /** |
||
117 | * @var \Doctrine\Common\Collections\Collection |
||
118 | * |
||
119 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderInvoiceTax", mappedBy="order") |
||
120 | */ |
||
121 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['invoiceTax' => 'exact'])] |
||
122 | |||
123 | private $invoiceTax; |
||
124 | |||
125 | /** |
||
126 | * @ORM\Column(name="alter_date", type="datetime", nullable=false) |
||
127 | * @Groups({"display_read","order_read","order_write"}) |
||
128 | */ |
||
129 | |||
130 | #[ApiFilter(DateFilter::class, properties: ['alterDate'])] |
||
131 | |||
132 | private $alterDate; |
||
133 | |||
134 | |||
135 | /** |
||
136 | * @var \ControleOnline\Entity\Status |
||
137 | * |
||
138 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Status") |
||
139 | * @ORM\JoinColumns({ |
||
140 | * @ORM\JoinColumn(name="status_id", referencedColumnName="id") |
||
141 | * }) |
||
142 | * @Groups({"display_read","order_read","order_write"}) |
||
143 | */ |
||
144 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['status' => 'exact'])] |
||
145 | |||
146 | private $status; |
||
147 | |||
148 | /** |
||
149 | * @var string |
||
150 | * |
||
151 | * @ORM\Column(name="order_type", type="string", nullable=true) |
||
152 | * @Groups({"display_read","order_read","order_write"}) |
||
153 | */ |
||
154 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderType' => 'exact'])] |
||
155 | |||
156 | private $orderType = 'Online'; |
||
157 | |||
158 | |||
159 | /** |
||
160 | * @var string |
||
161 | * |
||
162 | * @ORM\Column(name="app", type="string", nullable=true) |
||
163 | * @Groups({"display_read","order_read","order_write"}) |
||
164 | */ |
||
165 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['app' => 'exact'])] |
||
166 | |||
167 | private $app = 'Manual'; |
||
168 | |||
169 | /** |
||
170 | * @var string |
||
171 | * |
||
172 | * @ORM\Column(name="other_informations", type="json", nullable=true) |
||
173 | * @Groups({"order_read","order_write"}) |
||
174 | */ |
||
175 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['otherInformations' => 'exact'])] |
||
176 | |||
177 | private $otherInformations; |
||
178 | |||
179 | /** |
||
180 | * @var \ControleOnline\Entity\Order |
||
181 | * |
||
182 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Order") |
||
183 | * @ORM\JoinColumns({ |
||
184 | * @ORM\JoinColumn(name="main_order_id", referencedColumnName="id") |
||
185 | * }) |
||
186 | */ |
||
187 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrder' => 'exact'])] |
||
188 | |||
189 | private $mainOrder; |
||
190 | |||
191 | |||
192 | /** |
||
193 | * @var integer |
||
194 | * |
||
195 | * @ORM\Column(name="main_order_id", type="integer", nullable=true) |
||
196 | * @Groups({"order_read","order_write"}) |
||
197 | */ |
||
198 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['mainOrderId' => 'exact'])] |
||
199 | |||
200 | private $mainOrderId; |
||
201 | |||
202 | |||
203 | |||
204 | /** |
||
205 | * @var \ControleOnline\Entity\People |
||
206 | * |
||
207 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
208 | * @ORM\JoinColumns({ |
||
209 | * @ORM\JoinColumn(name="payer_people_id", referencedColumnName="id") |
||
210 | * }) |
||
211 | * @Groups({"order_read","order_write","task_read","invoice_read"}) |
||
212 | */ |
||
213 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['payer' => 'exact'])] |
||
214 | |||
215 | private $payer; |
||
216 | |||
217 | /** |
||
218 | * @var \ControleOnline\Entity\People |
||
219 | * |
||
220 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
221 | * @ORM\JoinColumns({ |
||
222 | * @ORM\JoinColumn(name="provider_id", referencedColumnName="id") |
||
223 | * }) |
||
224 | * @Groups({"order_read","order_write","invoice_read", "task_read"}) |
||
225 | */ |
||
226 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['provider' => 'exact'])] |
||
227 | |||
228 | private $provider; |
||
229 | |||
230 | |||
231 | |||
232 | /** |
||
233 | * @var \Doctrine\Common\Collections\Collection |
||
234 | * |
||
235 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Retrieve", mappedBy="order") |
||
236 | */ |
||
237 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieves' => 'exact'])] |
||
238 | |||
239 | private $retrieves; |
||
240 | |||
241 | /** |
||
242 | * @var \ControleOnline\Entity\Address |
||
243 | * |
||
244 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
245 | * @ORM\JoinColumns({ |
||
246 | * @ORM\JoinColumn(name="address_origin_id", referencedColumnName="id") |
||
247 | * }) |
||
248 | */ |
||
249 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])] |
||
250 | |||
251 | private $addressOrigin; |
||
252 | |||
253 | /** |
||
254 | * @var \ControleOnline\Entity\Address |
||
255 | * |
||
256 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
257 | * @ORM\JoinColumns({ |
||
258 | * @ORM\JoinColumn(name="address_destination_id", referencedColumnName="id") |
||
259 | * }) |
||
260 | */ |
||
261 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])] |
||
262 | |||
263 | private $addressDestination; |
||
264 | |||
265 | /** |
||
266 | * @var \ControleOnline\Entity\People |
||
267 | * |
||
268 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
269 | * @ORM\JoinColumns({ |
||
270 | * @ORM\JoinColumn(name="retrieve_contact_id", referencedColumnName="id") |
||
271 | * }) |
||
272 | */ |
||
273 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])] |
||
274 | |||
275 | private $retrieveContact; |
||
276 | |||
277 | /** |
||
278 | * @var \ControleOnline\Entity\People |
||
279 | * |
||
280 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
281 | * @ORM\JoinColumns({ |
||
282 | * @ORM\JoinColumn(name="delivery_contact_id", referencedColumnName="id") |
||
283 | * }) |
||
284 | */ |
||
285 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])] |
||
286 | |||
287 | private $deliveryContact; |
||
288 | |||
289 | /** |
||
290 | * @var \Doctrine\Common\Collections\Collection |
||
291 | * |
||
292 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderPackage", mappedBy="order") |
||
293 | */ |
||
294 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderPackage' => 'exact'])] |
||
295 | |||
296 | private $orderPackage; |
||
297 | |||
298 | /** |
||
299 | * @var float |
||
300 | * |
||
301 | * @ORM\Column(name="price", type="float", nullable=false) |
||
302 | * @Groups({"order_read","order_write"}) |
||
303 | */ |
||
304 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])] |
||
305 | |||
306 | private $price = 0; |
||
307 | |||
308 | |||
309 | |||
310 | /** |
||
311 | * @var string |
||
312 | * |
||
313 | * @ORM\Column(name="comments", type="string", nullable=true) |
||
314 | * @Groups({"order_read","order_write"}) |
||
315 | */ |
||
316 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])] |
||
317 | |||
318 | private $comments; |
||
319 | |||
320 | /** |
||
321 | * @var boolean |
||
322 | * |
||
323 | * @ORM\Column(name="notified", type="boolean") |
||
324 | */ |
||
325 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])] |
||
326 | |||
327 | private $notified = false; |
||
328 | |||
329 | /** |
||
330 | * @var \Doctrine\Common\Collections\Collection |
||
331 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderTracking", mappedBy="order") |
||
332 | * @ApiSubresource() |
||
333 | */ |
||
334 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['tracking' => 'exact'])] |
||
335 | |||
336 | private $tracking; |
||
337 | |||
338 | |||
339 | |||
340 | /** |
||
341 | * @var \Doctrine\Common\Collections\Collection |
||
342 | * |
||
343 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderQueue", mappedBy="order") |
||
344 | * @Groups({"order_read","order_write"}) |
||
345 | */ |
||
346 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderQueue' => 'exact'])] |
||
347 | |||
348 | private $orderQueue; |
||
349 | |||
350 | |||
351 | |||
352 | public function __construct() |
||
353 | { |
||
354 | $this->orderDate = new \DateTime('now'); |
||
355 | $this->alterDate = new \DateTime('now'); |
||
356 | $this->orderPackage = new ArrayCollection(); |
||
357 | $this->invoiceTax = new ArrayCollection(); |
||
358 | $this->invoice = new ArrayCollection(); |
||
359 | $this->retrieves = new ArrayCollection(); |
||
360 | $this->tracking = new ArrayCollection(); |
||
361 | $this->task = new ArrayCollection(); |
||
362 | $this->orderQueue = new ArrayCollection(); |
||
363 | $this->orderProducts = new ArrayCollection(); |
||
364 | // $this->parkingDate = new \DateTime('now'); |
||
365 | $this->otherInformations = json_encode(new stdClass()); |
||
366 | } |
||
367 | |||
368 | public function resetId() |
||
369 | { |
||
370 | $this->id = null; |
||
371 | $this->orderDate = new \DateTime('now'); |
||
372 | $this->alterDate = new \DateTime('now'); |
||
373 | // $this->parkingDate = new \DateTime('now'); |
||
374 | } |
||
375 | |||
376 | /** |
||
377 | * Get id |
||
378 | * |
||
379 | * @return integer |
||
380 | */ |
||
381 | public function getId() |
||
382 | { |
||
383 | return $this->id; |
||
384 | } |
||
385 | |||
386 | /** |
||
387 | * Set status |
||
388 | * |
||
389 | * @param \ControleOnline\Entity\Status $status |
||
390 | * @return Order |
||
391 | */ |
||
392 | public function setStatus(\ControleOnline\Entity\Status $status = null) |
||
393 | { |
||
394 | $this->status = $status; |
||
395 | |||
396 | return $this; |
||
397 | } |
||
398 | |||
399 | /** |
||
400 | * Get status |
||
401 | * |
||
402 | * @return \ControleOnline\Entity\Status |
||
403 | */ |
||
404 | public function getStatus() |
||
405 | { |
||
406 | return $this->status; |
||
407 | } |
||
408 | |||
409 | /** |
||
410 | * Set client |
||
411 | * |
||
412 | * @param \ControleOnline\Entity\People $client |
||
413 | * @return Order |
||
414 | */ |
||
415 | public function setClient(\ControleOnline\Entity\People $client = null) |
||
416 | { |
||
417 | $this->client = $client; |
||
418 | |||
419 | return $this; |
||
420 | } |
||
421 | |||
422 | /** |
||
423 | * Get client |
||
424 | * |
||
425 | * @return \ControleOnline\Entity\People |
||
426 | */ |
||
427 | public function getClient() |
||
428 | { |
||
429 | return $this->client; |
||
430 | } |
||
431 | |||
432 | /** |
||
433 | * Set provider |
||
434 | * |
||
435 | * @param \ControleOnline\Entity\People $provider |
||
436 | * @return Order |
||
437 | */ |
||
438 | public function setProvider(\ControleOnline\Entity\People $provider = null) |
||
439 | { |
||
440 | $this->provider = $provider; |
||
441 | |||
442 | return $this; |
||
443 | } |
||
444 | |||
445 | /** |
||
446 | * Get provider |
||
447 | * |
||
448 | * @return \ControleOnline\Entity\People |
||
449 | */ |
||
450 | public function getProvider() |
||
451 | { |
||
452 | return $this->provider; |
||
453 | } |
||
454 | |||
455 | /** |
||
456 | * Set price |
||
457 | * |
||
458 | * @param float $price |
||
459 | * @return Order |
||
460 | */ |
||
461 | public function setPrice($price) |
||
462 | { |
||
463 | $this->price = $price; |
||
464 | |||
465 | return $this; |
||
466 | } |
||
467 | |||
468 | /** |
||
469 | * Get price |
||
470 | * |
||
471 | * @return float |
||
472 | */ |
||
473 | public function getPrice() |
||
474 | { |
||
475 | return $this->price; |
||
476 | } |
||
477 | |||
478 | |||
479 | /** |
||
480 | * Set addressOrigin |
||
481 | * |
||
482 | * @param \ControleOnline\Entity\Address $address_origin |
||
483 | * @return Order |
||
484 | */ |
||
485 | public function setAddressOrigin(\ControleOnline\Entity\Address $address_origin = null) |
||
490 | } |
||
491 | |||
492 | /** |
||
493 | * Get addressOrigin |
||
494 | * |
||
495 | * @return \ControleOnline\Entity\Address |
||
496 | */ |
||
497 | public function getAddressOrigin() |
||
498 | { |
||
499 | return $this->addressOrigin; |
||
500 | } |
||
501 | |||
502 | /** |
||
503 | * Set addressDestination |
||
504 | * |
||
505 | * @param \ControleOnline\Entity\Address $address_destination |
||
506 | * @return Order |
||
507 | */ |
||
508 | public function setAddressDestination(\ControleOnline\Entity\Address $address_destination = null) |
||
509 | { |
||
510 | $this->addressDestination = $address_destination; |
||
511 | |||
512 | return $this; |
||
513 | } |
||
514 | |||
515 | /** |
||
516 | * Get quote |
||
517 | * |
||
518 | * @return \ControleOnline\Entity\Address |
||
519 | */ |
||
520 | public function getAddressDestination() |
||
521 | { |
||
522 | return $this->addressDestination; |
||
523 | } |
||
524 | |||
525 | /** |
||
526 | * Get retrieveContact |
||
527 | * |
||
528 | * @return \ControleOnline\Entity\People |
||
529 | */ |
||
530 | public function getRetrieveContact() |
||
531 | { |
||
532 | return $this->retrieveContact; |
||
533 | } |
||
534 | |||
535 | /** |
||
536 | * Set retrieveContact |
||
537 | * |
||
538 | * @param \ControleOnline\Entity\People $retrieve_contact |
||
539 | * @return Order |
||
540 | */ |
||
541 | public function setRetrieveContact(\ControleOnline\Entity\People $retrieve_contact = null) |
||
542 | { |
||
543 | $this->retrieveContact = $retrieve_contact; |
||
544 | |||
545 | return $this; |
||
546 | } |
||
547 | |||
548 | /** |
||
549 | * Get deliveryContact |
||
550 | * |
||
551 | * @return \ControleOnline\Entity\People |
||
552 | */ |
||
553 | public function getDeliveryContact() |
||
554 | { |
||
555 | return $this->deliveryContact; |
||
556 | } |
||
557 | |||
558 | /** |
||
559 | * Set deliveryContact |
||
560 | * |
||
561 | * @param \ControleOnline\Entity\People $delivery_contact |
||
562 | * @return Order |
||
563 | */ |
||
564 | public function setDeliveryContact(\ControleOnline\Entity\People $delivery_contact = null) |
||
565 | { |
||
566 | $this->deliveryContact = $delivery_contact; |
||
567 | |||
568 | return $this; |
||
569 | } |
||
570 | |||
571 | /** |
||
572 | * Set payer |
||
573 | * |
||
574 | * @param \ControleOnline\Entity\People $payer |
||
575 | * @return Order |
||
576 | */ |
||
577 | public function setPayer(\ControleOnline\Entity\People $payer = null) |
||
578 | { |
||
579 | $this->payer = $payer; |
||
580 | |||
581 | return $this; |
||
582 | } |
||
583 | |||
584 | /** |
||
585 | * Get payer |
||
586 | * |
||
587 | * @return \ControleOnline\Entity\People |
||
588 | */ |
||
589 | public function getPayer() |
||
592 | } |
||
593 | |||
594 | |||
595 | /** |
||
596 | * Set comments |
||
597 | * |
||
598 | * @param string $comments |
||
599 | * @return Order |
||
600 | */ |
||
601 | public function setComments($comments) |
||
602 | { |
||
603 | $this->comments = $comments; |
||
604 | |||
605 | return $this; |
||
606 | } |
||
607 | |||
608 | /** |
||
609 | * Get comments |
||
610 | * |
||
611 | * @return string |
||
612 | */ |
||
613 | public function getComments() |
||
614 | { |
||
615 | return $this->comments; |
||
616 | } |
||
617 | |||
618 | /** |
||
619 | * Get otherInformations |
||
620 | * |
||
621 | * @return stdClass |
||
622 | */ |
||
623 | public function getOtherInformations($decode = false) |
||
624 | { |
||
625 | return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations; |
||
626 | } |
||
627 | |||
628 | /** |
||
629 | * Set comments |
||
630 | * |
||
631 | * @param string $otherInformations |
||
632 | * @return Order |
||
633 | */ |
||
634 | public function addOtherInformations($key, $value) |
||
635 | { |
||
636 | $otherInformations = $this->getOtherInformations(true); |
||
637 | $otherInformations->$key = $value; |
||
638 | $this->otherInformations = json_encode($otherInformations); |
||
639 | return $this; |
||
640 | } |
||
641 | |||
642 | /** |
||
643 | * Set comments |
||
644 | * |
||
645 | * @param string $otherInformations |
||
646 | * @return Order |
||
647 | */ |
||
648 | public function setOtherInformations($otherInformations) |
||
649 | { |
||
650 | $this->otherInformations = json_encode($otherInformations); |
||
651 | return $this; |
||
652 | } |
||
653 | |||
654 | |||
655 | /** |
||
656 | * Get orderDate |
||
657 | * |
||
658 | * @return \DateTimeInterface |
||
659 | */ |
||
660 | public function getOrderDate() |
||
661 | { |
||
662 | return $this->orderDate; |
||
663 | } |
||
664 | |||
665 | /** |
||
666 | * Set alter_date |
||
667 | * |
||
668 | * @param \DateTimeInterface $alter_date |
||
669 | */ |
||
670 | public function setAlterDate(\DateTimeInterface $alter_date = null): self |
||
671 | { |
||
672 | $this->alterDate = $alter_date; |
||
673 | |||
674 | return $this; |
||
675 | } |
||
676 | |||
677 | /** |
||
678 | * Get alter_date |
||
679 | * |
||
680 | */ |
||
681 | public function getAlterDate(): ?\DateTimeInterface |
||
682 | { |
||
683 | return $this->alterDate; |
||
684 | } |
||
685 | |||
686 | /** |
||
687 | * Add orderPackage |
||
688 | * |
||
689 | * @param \ControleOnline\Entity\OrderPackage $order_package |
||
690 | * @return Order |
||
691 | */ |
||
692 | public function addOrderPackage(\ControleOnline\Entity\OrderPackage $order_package) |
||
693 | { |
||
694 | $this->orderPackage[] = $order_package; |
||
695 | |||
696 | return $this; |
||
697 | } |
||
698 | |||
699 | /** |
||
700 | * Remove orderPackage |
||
701 | * |
||
702 | * @param \ControleOnline\Entity\OrderPackage $order_package |
||
703 | */ |
||
704 | public function removeOrderPackage(\ControleOnline\Entity\OrderPackage $order_package) |
||
705 | { |
||
706 | $this->orderPackage->removeElement($order_package); |
||
707 | } |
||
708 | |||
709 | /** |
||
710 | * Get orderPackage |
||
711 | * |
||
712 | * @return \Doctrine\Common\Collections\Collection |
||
713 | */ |
||
714 | public function getOrderPackage() |
||
715 | { |
||
716 | return $this->orderPackage; |
||
717 | } |
||
718 | |||
719 | /** |
||
720 | * Add invoiceTax |
||
721 | * |
||
722 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
723 | * @return Order |
||
724 | */ |
||
725 | public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
726 | { |
||
727 | $this->invoiceTax[] = $invoice_tax; |
||
728 | |||
729 | return $this; |
||
730 | } |
||
731 | |||
732 | /** |
||
733 | * Remove invoiceTax |
||
734 | * |
||
735 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
736 | */ |
||
737 | public function removeInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
738 | { |
||
739 | $this->invoiceTax->removeElement($invoice_tax); |
||
740 | } |
||
741 | |||
742 | /** |
||
743 | * Get invoiceTax |
||
744 | * |
||
745 | * @return \Doctrine\Common\Collections\Collection |
||
746 | */ |
||
747 | public function getInvoiceTax() |
||
748 | { |
||
749 | return $this->invoiceTax; |
||
750 | } |
||
751 | |||
752 | |||
753 | |||
754 | /** |
||
755 | * Get invoiceTax |
||
756 | * |
||
757 | * @return \ControleOnline\Entity\InvoiceTax |
||
758 | */ |
||
759 | public function getClientInvoiceTax() |
||
760 | { |
||
761 | foreach ($this->getInvoiceTax() as $invoice) { |
||
762 | if ($invoice->getInvoiceType() == 55) { |
||
763 | return $invoice; |
||
764 | } |
||
765 | } |
||
766 | } |
||
767 | |||
768 | |||
769 | /** |
||
770 | * Get invoiceTax |
||
771 | * |
||
772 | * @return \ControleOnline\Entity\InvoiceTax |
||
773 | */ |
||
774 | public function getCarrierInvoiceTax() |
||
775 | { |
||
776 | foreach ($this->getInvoiceTax() as $invoice) { |
||
777 | if ($invoice->getInvoiceType() == 57) { |
||
778 | return $invoice->getInvoiceTax(); |
||
779 | } |
||
780 | } |
||
781 | } |
||
782 | |||
783 | /** |
||
784 | * Add OrderInvoice |
||
785 | * |
||
786 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
787 | * @return People |
||
788 | */ |
||
789 | public function addInvoice(OrderInvoice $invoice) |
||
790 | { |
||
791 | $this->invoice[] = $invoice; |
||
792 | |||
793 | return $this; |
||
794 | } |
||
795 | |||
796 | /** |
||
797 | * Remove OrderInvoice |
||
798 | * |
||
799 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
800 | */ |
||
801 | public function removeInvoice(OrderInvoice $invoice) |
||
802 | { |
||
803 | $this->invoice->removeElement($invoice); |
||
804 | } |
||
805 | |||
806 | /** |
||
807 | * Get OrderInvoice |
||
808 | * |
||
809 | * @return \Doctrine\Common\Collections\Collection |
||
810 | */ |
||
811 | public function getInvoice() |
||
812 | { |
||
813 | return $this->invoice; |
||
814 | } |
||
815 | |||
816 | /** |
||
817 | * Add retrieves |
||
818 | * |
||
819 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
820 | * @return Order |
||
821 | */ |
||
822 | public function addARetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
823 | { |
||
824 | $this->retrieves[] = $retrieves; |
||
825 | |||
826 | return $this; |
||
827 | } |
||
828 | |||
829 | /** |
||
830 | * Remove retrieves |
||
831 | * |
||
832 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
833 | */ |
||
834 | public function removeRetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
835 | { |
||
836 | $this->retrieves->removeElement($retrieves); |
||
837 | } |
||
838 | |||
839 | /** |
||
840 | * Get retrieves |
||
841 | * |
||
842 | * @return \Doctrine\Common\Collections\Collection |
||
843 | */ |
||
844 | public function getRetrieves() |
||
845 | { |
||
846 | return $this->retrieves; |
||
847 | } |
||
848 | |||
849 | /** |
||
850 | * Get Notified |
||
851 | * |
||
852 | * @return boolean |
||
853 | */ |
||
854 | public function getNotified() |
||
855 | { |
||
856 | return $this->notified; |
||
857 | } |
||
858 | |||
859 | /** |
||
860 | * Set Notified |
||
861 | * |
||
862 | * @param boolean $notified |
||
863 | * @return People |
||
864 | */ |
||
865 | public function setNotified($notified) |
||
866 | { |
||
867 | $this->notified = $notified ? 1 : 0; |
||
868 | |||
869 | return $this; |
||
870 | } |
||
871 | |||
872 | /** |
||
873 | * Set orderType |
||
874 | * |
||
875 | * @param string $orderType |
||
876 | * @return Order |
||
877 | */ |
||
878 | public function setOrderType($order_type) |
||
879 | { |
||
880 | $this->orderType = $order_type; |
||
881 | |||
882 | return $this; |
||
883 | } |
||
884 | |||
885 | /** |
||
886 | * Get orderType |
||
887 | * |
||
888 | * @return string |
||
889 | */ |
||
890 | public function getOrderType() |
||
891 | { |
||
892 | return $this->orderType; |
||
893 | } |
||
894 | |||
895 | /** |
||
896 | * Set app |
||
897 | * |
||
898 | * @param string $app |
||
899 | * @return Order |
||
900 | */ |
||
901 | public function setApp($app) |
||
902 | { |
||
903 | $this->app = $app; |
||
904 | |||
905 | return $this; |
||
906 | } |
||
907 | |||
908 | /** |
||
909 | * Get app |
||
910 | * |
||
911 | * @return string |
||
912 | */ |
||
913 | public function getApp() |
||
914 | { |
||
915 | return $this->app; |
||
916 | } |
||
917 | |||
918 | |||
919 | |||
920 | /** |
||
921 | * Set mainOrder |
||
922 | * |
||
923 | * @param \ControleOnline\Entity\Order $mainOrder |
||
924 | * @return Order |
||
925 | */ |
||
926 | public function setMainOrder(\ControleOnline\Entity\Order $main_order = null) |
||
927 | { |
||
928 | $this->mainOrder = $main_order; |
||
929 | |||
930 | return $this; |
||
931 | } |
||
932 | |||
933 | /** |
||
934 | * Get mainOrder |
||
935 | * |
||
936 | * @return \ControleOnline\Entity\Order |
||
937 | */ |
||
938 | public function getMainOrder() |
||
939 | { |
||
940 | return $this->mainOrder; |
||
941 | } |
||
942 | |||
943 | /** |
||
944 | * Set mainOrderId |
||
945 | * |
||
946 | * @param integer $mainOrderId |
||
947 | * @return Order |
||
948 | */ |
||
949 | public function setMainOrderId($mainOrderId) |
||
950 | { |
||
951 | $this->mainOrderId = $mainOrderId; |
||
952 | |||
953 | return $this; |
||
954 | } |
||
955 | |||
956 | /** |
||
957 | * Get mainOrderId |
||
958 | * |
||
959 | * @return integer |
||
960 | */ |
||
961 | public function getMainOrderId() |
||
962 | { |
||
963 | return $this->mainOrderId; |
||
964 | } |
||
965 | |||
966 | |||
967 | |||
968 | public function getInvoiceByStatus(array $status) |
||
969 | { |
||
970 | foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
||
971 | $invoice = $purchasingOrderInvoice->getInvoice(); |
||
972 | if (in_array($invoice->getStatus()->getStatus(), $status)) { |
||
973 | return $invoice; |
||
974 | } |
||
975 | } |
||
976 | } |
||
977 | |||
978 | |||
979 | public function canAccess($currentUser): bool |
||
980 | { |
||
981 | if (($provider = $this->getProvider()) === null) |
||
982 | return false; |
||
983 | |||
984 | return $currentUser->getPeople()->getLink()->exists( |
||
985 | function ($key, $element) use ($provider) { |
||
986 | return $element->getCompany() === $provider; |
||
987 | } |
||
988 | ); |
||
989 | } |
||
990 | |||
991 | public function justOpened(): bool |
||
992 | { |
||
993 | return $this->getStatus()->getStatus() == 'quote'; |
||
994 | } |
||
995 | |||
996 | /** |
||
997 | * Get tracking |
||
998 | * |
||
999 | * @return \Doctrine\Common\Collections\Collection |
||
1000 | */ |
||
1001 | public function getTracking() |
||
1002 | { |
||
1003 | return $this->tracking; |
||
1004 | } |
||
1005 | |||
1006 | public function getOneInvoice() |
||
1007 | { |
||
1008 | return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
||
1009 | null : $invoiceOrders->getInvoice(); |
||
1010 | } |
||
1011 | |||
1012 | /** |
||
1013 | * Add Task |
||
1014 | * |
||
1015 | * @param \ControleOnline\Entity\Task $task |
||
1016 | * @return Order |
||
1017 | */ |
||
1018 | public function addTask(\ControleOnline\Entity\Task $task) |
||
1019 | { |
||
1020 | $this->task[] = $task; |
||
1021 | |||
1022 | return $this; |
||
1023 | } |
||
1024 | |||
1025 | /** |
||
1026 | * Remove Task |
||
1027 | * |
||
1028 | * @param \ControleOnline\Entity\Task $task |
||
1029 | */ |
||
1030 | public function removeTask(\ControleOnline\Entity\Task $task) |
||
1031 | { |
||
1032 | $this->task->removeElement($task); |
||
1033 | } |
||
1034 | |||
1035 | /** |
||
1036 | * Get Task |
||
1037 | * |
||
1038 | * @return \Doctrine\Common\Collections\Collection |
||
1039 | */ |
||
1040 | public function getTask() |
||
1041 | { |
||
1042 | return $this->task; |
||
1043 | } |
||
1044 | |||
1045 | /** |
||
1046 | * Add OrderQueue |
||
1047 | * |
||
1048 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
1049 | * @return Order |
||
1050 | */ |
||
1051 | public function addAOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
1052 | { |
||
1053 | $this->orderQueue[] = $orderQueue; |
||
1054 | |||
1055 | return $this; |
||
1056 | } |
||
1057 | |||
1058 | /** |
||
1059 | * Remove OrderQueue |
||
1060 | * |
||
1061 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
1062 | */ |
||
1063 | public function removeOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
1064 | { |
||
1065 | $this->orderQueue->removeElement($orderQueue); |
||
1066 | } |
||
1067 | |||
1068 | /** |
||
1069 | * Get OrderQueue |
||
1070 | * |
||
1071 | * @return \Doctrine\Common\Collections\Collection |
||
1072 | */ |
||
1073 | public function getOrderQueue() |
||
1074 | { |
||
1075 | return $this->orderQueue; |
||
1076 | } |
||
1077 | |||
1078 | public function isOriginAndDestinationTheSame(): ?bool |
||
1098 | } |
||
1099 | |||
1100 | public function isOriginAndDestinationTheSameState(): ?bool |
||
1101 | { |
||
1102 | if (($origin = $this->getAddressOrigin()) === null) { |
||
1103 | return null; |
||
1104 | } |
||
1105 | |||
1106 | if (($destination = $this->getAddressDestination()) === null) { |
||
1107 | return null; |
||
1108 | } |
||
1109 | |||
1110 | $origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
||
1111 | $destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
||
1112 | |||
1113 | // both objects are the same entity ( = same name and same country) |
||
1114 | |||
1115 | if ($origState === $destState) { |
||
1116 | return true; |
||
1117 | } |
||
1118 | |||
1119 | return false; |
||
1120 | } |
||
1121 | |||
1122 | |||
1123 | public function getOrderProducts() |
||
1124 | { |
||
1125 | return $this->orderProducts; |
||
1126 | } |
||
1127 | |||
1128 | public function addOrderProduct(OrderProduct $orderProduct): self |
||
1132 | } |
||
1133 | |||
1134 | public function removeOrderProduct(OrderProduct $orderProduct): self |
||
1135 | { |
||
1136 | $this->orderProducts->removeElement($orderProduct); |
||
1137 | return $this; |
||
1138 | } |
||
1139 | } |
||
1140 |
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths