Total Complexity | 93 |
Total Lines | 1214 |
Duplicated Lines | 0 % |
Changes | 19 | ||
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 | |||
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\OrderInvoiceTax", 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\Order |
||
182 | * |
||
183 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Order") |
||
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 |
||
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 |
||
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 |
||
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) |
||
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() |
||
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; |
||
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) |
||
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) |
||
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\OrderInvoiceTax $invoice_tax |
||
778 | * @return Order |
||
779 | */ |
||
780 | public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
781 | { |
||
782 | $this->invoiceTax[] = $invoice_tax; |
||
783 | |||
784 | return $this; |
||
785 | } |
||
786 | |||
787 | /** |
||
788 | * Remove invoiceTax |
||
789 | * |
||
790 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
791 | */ |
||
792 | public function removeInvoiceTax(OrderInvoiceTax $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() |
||
805 | } |
||
806 | |||
807 | |||
808 | |||
809 | /** |
||
810 | * Get invoiceTax |
||
811 | * |
||
812 | * @return \ControleOnline\Entity\InvoiceTax |
||
813 | */ |
||
814 | public function getClientInvoiceTax() |
||
815 | { |
||
816 | foreach ($this->getInvoiceTax() as $invoice) { |
||
817 | if ($invoice->getInvoiceType() == 55) { |
||
818 | return $invoice; |
||
819 | } |
||
820 | } |
||
821 | } |
||
822 | |||
823 | |||
824 | /** |
||
825 | * Get invoiceTax |
||
826 | * |
||
827 | * @return \ControleOnline\Entity\InvoiceTax |
||
828 | */ |
||
829 | public function getCarrierInvoiceTax() |
||
830 | { |
||
831 | foreach ($this->getInvoiceTax() as $invoice) { |
||
832 | if ($invoice->getInvoiceType() == 57) { |
||
833 | return $invoice->getInvoiceTax(); |
||
834 | } |
||
835 | } |
||
836 | } |
||
837 | |||
838 | /** |
||
839 | * Add OrderInvoice |
||
840 | * |
||
841 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
842 | * @return People |
||
843 | */ |
||
844 | public function addInvoice(OrderInvoice $invoice) |
||
845 | { |
||
846 | $this->invoice[] = $invoice; |
||
847 | |||
848 | return $this; |
||
849 | } |
||
850 | |||
851 | /** |
||
852 | * Remove OrderInvoice |
||
853 | * |
||
854 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
855 | */ |
||
856 | public function removeInvoice(OrderInvoice $invoice) |
||
857 | { |
||
858 | $this->invoice->removeElement($invoice); |
||
859 | } |
||
860 | |||
861 | /** |
||
862 | * Get OrderInvoice |
||
863 | * |
||
864 | * @return \Doctrine\Common\Collections\Collection |
||
865 | */ |
||
866 | public function getInvoice() |
||
867 | { |
||
868 | return $this->invoice; |
||
869 | } |
||
870 | |||
871 | /** |
||
872 | * Add quotes |
||
873 | * |
||
874 | * @param \ControleOnline\Entity\Quotation $quotes |
||
875 | * @return Order |
||
876 | */ |
||
877 | public function addAQuotes(\ControleOnline\Entity\Quotation $quotes) |
||
878 | { |
||
879 | $this->quotes[] = $quotes; |
||
880 | |||
881 | return $this; |
||
882 | } |
||
883 | |||
884 | /** |
||
885 | * Remove quotes |
||
886 | * |
||
887 | * @param \ControleOnline\Entity\Quotation $quotes |
||
888 | */ |
||
889 | public function removeQuotes(\ControleOnline\Entity\Quotation $quotes) |
||
890 | { |
||
891 | $this->quotes->removeElement($quotes); |
||
892 | } |
||
893 | |||
894 | /** |
||
895 | * Get quotes |
||
896 | * |
||
897 | * @return \Doctrine\Common\Collections\Collection |
||
898 | */ |
||
899 | public function getQuotes() |
||
900 | { |
||
901 | return $this->quotes; |
||
902 | } |
||
903 | |||
904 | /** |
||
905 | * Add retrieves |
||
906 | * |
||
907 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
908 | * @return Order |
||
909 | */ |
||
910 | public function addARetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
911 | { |
||
912 | $this->retrieves[] = $retrieves; |
||
913 | |||
914 | return $this; |
||
915 | } |
||
916 | |||
917 | /** |
||
918 | * Remove retrieves |
||
919 | * |
||
920 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
921 | */ |
||
922 | public function removeRetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
923 | { |
||
924 | $this->retrieves->removeElement($retrieves); |
||
925 | } |
||
926 | |||
927 | /** |
||
928 | * Get retrieves |
||
929 | * |
||
930 | * @return \Doctrine\Common\Collections\Collection |
||
931 | */ |
||
932 | public function getRetrieves() |
||
933 | { |
||
934 | return $this->retrieves; |
||
935 | } |
||
936 | |||
937 | /** |
||
938 | * Get Notified |
||
939 | * |
||
940 | * @return boolean |
||
941 | */ |
||
942 | public function getNotified() |
||
943 | { |
||
944 | return $this->notified; |
||
945 | } |
||
946 | |||
947 | /** |
||
948 | * Set Notified |
||
949 | * |
||
950 | * @param boolean $notified |
||
951 | * @return People |
||
952 | */ |
||
953 | public function setNotified($notified) |
||
954 | { |
||
955 | $this->notified = $notified ? 1 : 0; |
||
956 | |||
957 | return $this; |
||
958 | } |
||
959 | |||
960 | /** |
||
961 | * Set orderType |
||
962 | * |
||
963 | * @param string $orderType |
||
964 | * @return Order |
||
965 | */ |
||
966 | public function setOrderType($order_type) |
||
967 | { |
||
968 | $this->orderType = $order_type; |
||
969 | |||
970 | return $this; |
||
971 | } |
||
972 | |||
973 | /** |
||
974 | * Get orderType |
||
975 | * |
||
976 | * @return string |
||
977 | */ |
||
978 | public function getOrderType() |
||
979 | { |
||
980 | return $this->orderType; |
||
981 | } |
||
982 | |||
983 | /** |
||
984 | * Set app |
||
985 | * |
||
986 | * @param string $app |
||
987 | * @return Order |
||
988 | */ |
||
989 | public function setApp($app) |
||
990 | { |
||
991 | $this->app = $app; |
||
992 | |||
993 | return $this; |
||
994 | } |
||
995 | |||
996 | /** |
||
997 | * Get app |
||
998 | * |
||
999 | * @return string |
||
1000 | */ |
||
1001 | public function getApp() |
||
1002 | { |
||
1003 | return $this->app; |
||
1004 | } |
||
1005 | |||
1006 | |||
1007 | |||
1008 | /** |
||
1009 | * Set mainOrder |
||
1010 | * |
||
1011 | * @param \ControleOnline\Entity\Order $mainOrder |
||
1012 | * @return Order |
||
1013 | */ |
||
1014 | public function setMainOrder(\ControleOnline\Entity\Order $main_order = null) |
||
1015 | { |
||
1016 | $this->mainOrder = $main_order; |
||
1017 | |||
1018 | return $this; |
||
1019 | } |
||
1020 | |||
1021 | /** |
||
1022 | * Get mainOrder |
||
1023 | * |
||
1024 | * @return \ControleOnline\Entity\Order |
||
1025 | */ |
||
1026 | public function getMainOrder() |
||
1027 | { |
||
1028 | return $this->mainOrder; |
||
1029 | } |
||
1030 | |||
1031 | /** |
||
1032 | * Set mainOrderId |
||
1033 | * |
||
1034 | * @param integer $mainOrderId |
||
1035 | * @return Order |
||
1036 | */ |
||
1037 | public function setMainOrderId($mainOrderId) |
||
1038 | { |
||
1039 | $this->mainOrderId = $mainOrderId; |
||
1040 | |||
1041 | return $this; |
||
1042 | } |
||
1043 | |||
1044 | /** |
||
1045 | * Get mainOrderId |
||
1046 | * |
||
1047 | * @return integer |
||
1048 | */ |
||
1049 | public function getMainOrderId() |
||
1050 | { |
||
1051 | return $this->mainOrderId; |
||
1052 | } |
||
1053 | |||
1054 | /** |
||
1055 | * Set contract |
||
1056 | * |
||
1057 | * @param \ControleOnline\Entity\Contract $contract |
||
1058 | * @return Order |
||
1059 | */ |
||
1060 | public function setContract($contract) |
||
1061 | { |
||
1062 | $this->contract = $contract; |
||
1063 | |||
1064 | return $this; |
||
1065 | } |
||
1066 | |||
1067 | public function getInvoiceByStatus(array $status) |
||
1068 | { |
||
1069 | foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
||
1070 | $invoice = $purchasingOrderInvoice->getInvoice(); |
||
1071 | if (in_array($invoice->getStatus()->getStatus(), $status)) { |
||
1072 | return $invoice; |
||
1073 | } |
||
1074 | } |
||
1075 | } |
||
1076 | /** |
||
1077 | * Get contract |
||
1078 | * |
||
1079 | * @return \ControleOnline\Entity\Contract |
||
1080 | */ |
||
1081 | public function getContract() |
||
1082 | { |
||
1083 | return $this->contract; |
||
1084 | } |
||
1085 | |||
1086 | public function canAccess($currentUser): bool |
||
1087 | { |
||
1088 | if (($provider = $this->getProvider()) === null) |
||
1089 | return false; |
||
1090 | |||
1091 | return $currentUser->getPeople()->getLink()->exists( |
||
1092 | function ($key, $element) use ($provider) { |
||
1093 | return $element->getCompany() === $provider; |
||
1094 | } |
||
1095 | ); |
||
1096 | } |
||
1097 | |||
1098 | public function justOpened(): bool |
||
1099 | { |
||
1100 | return $this->getStatus()->getStatus() == 'quote'; |
||
1101 | } |
||
1102 | |||
1103 | /** |
||
1104 | * Get tracking |
||
1105 | * |
||
1106 | * @return \Doctrine\Common\Collections\Collection |
||
1107 | */ |
||
1108 | public function getTracking() |
||
1109 | { |
||
1110 | return $this->tracking; |
||
1111 | } |
||
1112 | |||
1113 | public function getOneInvoice() |
||
1114 | { |
||
1115 | return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
||
1116 | null : $invoiceOrders->getInvoice(); |
||
1117 | } |
||
1118 | |||
1119 | /** |
||
1120 | * Add Task |
||
1121 | * |
||
1122 | * @param \ControleOnline\Entity\Task $task |
||
1123 | * @return Order |
||
1124 | */ |
||
1125 | public function addTask(\ControleOnline\Entity\Task $task) |
||
1126 | { |
||
1127 | $this->task[] = $task; |
||
1128 | |||
1129 | return $this; |
||
1130 | } |
||
1131 | |||
1132 | /** |
||
1133 | * Remove Task |
||
1134 | * |
||
1135 | * @param \ControleOnline\Entity\Task $task |
||
1136 | */ |
||
1137 | public function removeTask(\ControleOnline\Entity\Task $task) |
||
1138 | { |
||
1139 | $this->task->removeElement($task); |
||
1140 | } |
||
1141 | |||
1142 | /** |
||
1143 | * Get Task |
||
1144 | * |
||
1145 | * @return \Doctrine\Common\Collections\Collection |
||
1146 | */ |
||
1147 | public function getTask() |
||
1148 | { |
||
1149 | return $this->task; |
||
1150 | } |
||
1151 | |||
1152 | /** |
||
1153 | * Add OrderQueue |
||
1154 | * |
||
1155 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
1156 | * @return Order |
||
1157 | */ |
||
1158 | public function addAOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
1159 | { |
||
1160 | $this->orderQueue[] = $orderQueue; |
||
1161 | |||
1162 | return $this; |
||
1163 | } |
||
1164 | |||
1165 | /** |
||
1166 | * Remove OrderQueue |
||
1167 | * |
||
1168 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
1169 | */ |
||
1170 | public function removeOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
1171 | { |
||
1172 | $this->orderQueue->removeElement($orderQueue); |
||
1173 | } |
||
1174 | |||
1175 | /** |
||
1176 | * Get OrderQueue |
||
1177 | * |
||
1178 | * @return \Doctrine\Common\Collections\Collection |
||
1179 | */ |
||
1180 | public function getOrderQueue() |
||
1181 | { |
||
1182 | return $this->orderQueue; |
||
1183 | } |
||
1184 | |||
1185 | public function isOriginAndDestinationTheSame(): ?bool |
||
1205 | } |
||
1206 | |||
1207 | public function isOriginAndDestinationTheSameState(): ?bool |
||
1208 | { |
||
1209 | if (($origin = $this->getAddressOrigin()) === null) { |
||
1210 | return null; |
||
1211 | } |
||
1212 | |||
1213 | if (($destination = $this->getAddressDestination()) === null) { |
||
1214 | return null; |
||
1215 | } |
||
1216 | |||
1217 | $origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
||
1218 | $destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
||
1219 | |||
1220 | // both objects are the same entity ( = same name and same country) |
||
1221 | |||
1222 | if ($origState === $destState) { |
||
1223 | return true; |
||
1224 | } |
||
1225 | |||
1226 | return false; |
||
1227 | } |
||
1228 | |||
1229 | |||
1230 | public function getOrderProducts() |
||
1231 | { |
||
1232 | return $this->orderProducts; |
||
1233 | } |
||
1234 | |||
1235 | public function addOrderProduct(OrderProduct $orderProduct): self |
||
1239 | } |
||
1240 | |||
1241 | public function removeOrderProduct(OrderProduct $orderProduct): self |
||
1242 | { |
||
1243 | $this->orderProducts->removeElement($orderProduct); |
||
1244 | return $this; |
||
1245 | } |
||
1246 | } |
||
1247 |
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