| Total Complexity | 91 |
| Total Lines | 1183 |
| Duplicated Lines | 0 % |
| Changes | 21 | ||
| 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 | * @var \ControleOnline\Entity\Quotation |
||
| 232 | * |
||
| 233 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Quotation") |
||
| 234 | * @ORM\JoinColumns({ |
||
| 235 | * @ORM\JoinColumn(name="quote_id", referencedColumnName="id") |
||
| 236 | * }) |
||
| 237 | * @Groups({"order_read","order_write"}) |
||
| 238 | */ |
||
| 239 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['quote' => 'exact'])] |
||
| 240 | |||
| 241 | private $quote; |
||
| 242 | |||
| 243 | /** |
||
| 244 | * @var \Doctrine\Common\Collections\Collection |
||
| 245 | * |
||
| 246 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Quotation", mappedBy="order") |
||
| 247 | */ |
||
| 248 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['quotes' => 'exact'])] |
||
| 249 | |||
| 250 | private $quotes; |
||
| 251 | |||
| 252 | /** |
||
| 253 | * @var \Doctrine\Common\Collections\Collection |
||
| 254 | * |
||
| 255 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\Retrieve", mappedBy="order") |
||
| 256 | */ |
||
| 257 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieves' => 'exact'])] |
||
| 258 | |||
| 259 | private $retrieves; |
||
| 260 | |||
| 261 | /** |
||
| 262 | * @var \ControleOnline\Entity\Address |
||
| 263 | * |
||
| 264 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
| 265 | * @ORM\JoinColumns({ |
||
| 266 | * @ORM\JoinColumn(name="address_origin_id", referencedColumnName="id") |
||
| 267 | * }) |
||
| 268 | */ |
||
| 269 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressOrigin' => 'exact'])] |
||
| 270 | |||
| 271 | private $addressOrigin; |
||
| 272 | |||
| 273 | /** |
||
| 274 | * @var \ControleOnline\Entity\Address |
||
| 275 | * |
||
| 276 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\Address") |
||
| 277 | * @ORM\JoinColumns({ |
||
| 278 | * @ORM\JoinColumn(name="address_destination_id", referencedColumnName="id") |
||
| 279 | * }) |
||
| 280 | */ |
||
| 281 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['addressDestination' => 'exact'])] |
||
| 282 | |||
| 283 | private $addressDestination; |
||
| 284 | |||
| 285 | /** |
||
| 286 | * @var \ControleOnline\Entity\People |
||
| 287 | * |
||
| 288 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
| 289 | * @ORM\JoinColumns({ |
||
| 290 | * @ORM\JoinColumn(name="retrieve_contact_id", referencedColumnName="id") |
||
| 291 | * }) |
||
| 292 | */ |
||
| 293 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['retrieveContact' => 'exact'])] |
||
| 294 | |||
| 295 | private $retrieveContact; |
||
| 296 | |||
| 297 | /** |
||
| 298 | * @var \ControleOnline\Entity\People |
||
| 299 | * |
||
| 300 | * @ORM\ManyToOne(targetEntity="ControleOnline\Entity\People") |
||
| 301 | * @ORM\JoinColumns({ |
||
| 302 | * @ORM\JoinColumn(name="delivery_contact_id", referencedColumnName="id") |
||
| 303 | * }) |
||
| 304 | */ |
||
| 305 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['deliveryContact' => 'exact'])] |
||
| 306 | |||
| 307 | private $deliveryContact; |
||
| 308 | |||
| 309 | /** |
||
| 310 | * @var \Doctrine\Common\Collections\Collection |
||
| 311 | * |
||
| 312 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderPackage", mappedBy="order") |
||
| 313 | */ |
||
| 314 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderPackage' => 'exact'])] |
||
| 315 | |||
| 316 | private $orderPackage; |
||
| 317 | |||
| 318 | /** |
||
| 319 | * @var float |
||
| 320 | * |
||
| 321 | * @ORM\Column(name="price", type="float", nullable=false) |
||
| 322 | * @Groups({"order_read","order_write"}) |
||
| 323 | */ |
||
| 324 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['price' => 'exact'])] |
||
| 325 | |||
| 326 | private $price = 0; |
||
| 327 | |||
| 328 | |||
| 329 | |||
| 330 | /** |
||
| 331 | * @var string |
||
| 332 | * |
||
| 333 | * @ORM\Column(name="comments", type="string", nullable=true) |
||
| 334 | * @Groups({"order_read","order_write"}) |
||
| 335 | */ |
||
| 336 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['comments' => 'exact'])] |
||
| 337 | |||
| 338 | private $comments; |
||
| 339 | |||
| 340 | /** |
||
| 341 | * @var boolean |
||
| 342 | * |
||
| 343 | * @ORM\Column(name="notified", type="boolean") |
||
| 344 | */ |
||
| 345 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['notified' => 'exact'])] |
||
| 346 | |||
| 347 | private $notified = false; |
||
| 348 | |||
| 349 | /** |
||
| 350 | * @var \Doctrine\Common\Collections\Collection |
||
| 351 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderTracking", mappedBy="order") |
||
| 352 | * @ApiSubresource() |
||
| 353 | */ |
||
| 354 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['tracking' => 'exact'])] |
||
| 355 | |||
| 356 | private $tracking; |
||
| 357 | |||
| 358 | |||
| 359 | |||
| 360 | /** |
||
| 361 | * @var \Doctrine\Common\Collections\Collection |
||
| 362 | * |
||
| 363 | * @ORM\OneToMany(targetEntity="ControleOnline\Entity\OrderQueue", mappedBy="order") |
||
| 364 | * @Groups({"order_read","order_write"}) |
||
| 365 | */ |
||
| 366 | #[ApiFilter(filterClass: SearchFilter::class, properties: ['orderQueue' => 'exact'])] |
||
| 367 | |||
| 368 | private $orderQueue; |
||
| 369 | |||
| 370 | |||
| 371 | |||
| 372 | public function __construct() |
||
| 373 | { |
||
| 374 | $this->orderDate = new \DateTime('now'); |
||
| 375 | $this->alterDate = new \DateTime('now'); |
||
| 376 | $this->orderPackage = new ArrayCollection(); |
||
| 377 | $this->invoiceTax = new ArrayCollection(); |
||
| 378 | $this->invoice = new ArrayCollection(); |
||
| 379 | $this->quotes = new ArrayCollection(); |
||
| 380 | $this->retrieves = new ArrayCollection(); |
||
| 381 | $this->tracking = new ArrayCollection(); |
||
| 382 | $this->task = new ArrayCollection(); |
||
| 383 | $this->orderQueue = new ArrayCollection(); |
||
| 384 | $this->orderProducts = new ArrayCollection(); |
||
| 385 | // $this->parkingDate = new \DateTime('now'); |
||
| 386 | $this->otherInformations = json_encode(new stdClass()); |
||
| 387 | } |
||
| 388 | |||
| 389 | public function resetId() |
||
| 390 | { |
||
| 391 | $this->id = null; |
||
| 392 | $this->orderDate = new \DateTime('now'); |
||
| 393 | $this->alterDate = new \DateTime('now'); |
||
| 394 | // $this->parkingDate = new \DateTime('now'); |
||
| 395 | } |
||
| 396 | |||
| 397 | /** |
||
| 398 | * Get id |
||
| 399 | * |
||
| 400 | * @return integer |
||
| 401 | */ |
||
| 402 | public function getId() |
||
| 403 | { |
||
| 404 | return $this->id; |
||
| 405 | } |
||
| 406 | |||
| 407 | /** |
||
| 408 | * Set status |
||
| 409 | * |
||
| 410 | * @param \ControleOnline\Entity\Status $status |
||
| 411 | * @return Order |
||
| 412 | */ |
||
| 413 | public function setStatus(\ControleOnline\Entity\Status $status = null) |
||
| 414 | { |
||
| 415 | $this->status = $status; |
||
| 416 | |||
| 417 | return $this; |
||
| 418 | } |
||
| 419 | |||
| 420 | /** |
||
| 421 | * Get status |
||
| 422 | * |
||
| 423 | * @return \ControleOnline\Entity\Status |
||
| 424 | */ |
||
| 425 | public function getStatus() |
||
| 426 | { |
||
| 427 | return $this->status; |
||
| 428 | } |
||
| 429 | |||
| 430 | /** |
||
| 431 | * Set client |
||
| 432 | * |
||
| 433 | * @param \ControleOnline\Entity\People $client |
||
| 434 | * @return Order |
||
| 435 | */ |
||
| 436 | public function setClient(\ControleOnline\Entity\People $client = null) |
||
| 437 | { |
||
| 438 | $this->client = $client; |
||
| 439 | |||
| 440 | return $this; |
||
| 441 | } |
||
| 442 | |||
| 443 | /** |
||
| 444 | * Get client |
||
| 445 | * |
||
| 446 | * @return \ControleOnline\Entity\People |
||
| 447 | */ |
||
| 448 | public function getClient() |
||
| 449 | { |
||
| 450 | return $this->client; |
||
| 451 | } |
||
| 452 | |||
| 453 | /** |
||
| 454 | * Set provider |
||
| 455 | * |
||
| 456 | * @param \ControleOnline\Entity\People $provider |
||
| 457 | * @return Order |
||
| 458 | */ |
||
| 459 | public function setProvider(\ControleOnline\Entity\People $provider = null) |
||
| 460 | { |
||
| 461 | $this->provider = $provider; |
||
| 462 | |||
| 463 | return $this; |
||
| 464 | } |
||
| 465 | |||
| 466 | /** |
||
| 467 | * Get provider |
||
| 468 | * |
||
| 469 | * @return \ControleOnline\Entity\People |
||
| 470 | */ |
||
| 471 | public function getProvider() |
||
| 472 | { |
||
| 473 | return $this->provider; |
||
| 474 | } |
||
| 475 | |||
| 476 | /** |
||
| 477 | * Set price |
||
| 478 | * |
||
| 479 | * @param float $price |
||
| 480 | * @return Order |
||
| 481 | */ |
||
| 482 | public function setPrice($price) |
||
| 483 | { |
||
| 484 | $this->price = $price; |
||
| 485 | |||
| 486 | return $this; |
||
| 487 | } |
||
| 488 | |||
| 489 | /** |
||
| 490 | * Get price |
||
| 491 | * |
||
| 492 | * @return float |
||
| 493 | */ |
||
| 494 | public function getPrice() |
||
| 495 | { |
||
| 496 | return $this->price; |
||
| 497 | } |
||
| 498 | |||
| 499 | /** |
||
| 500 | * Set quote |
||
| 501 | * |
||
| 502 | * @param \ControleOnline\Entity\Quotation $quote |
||
| 503 | * @return Order |
||
| 504 | */ |
||
| 505 | public function setQuote(\ControleOnline\Entity\Quotation $quote = null) |
||
| 506 | { |
||
| 507 | $this->quote = $quote; |
||
| 508 | |||
| 509 | return $this; |
||
| 510 | } |
||
| 511 | |||
| 512 | /** |
||
| 513 | * Get quote |
||
| 514 | * |
||
| 515 | * @return \ControleOnline\Entity\Quotation |
||
| 516 | */ |
||
| 517 | public function getQuote() |
||
| 518 | { |
||
| 519 | return $this->quote; |
||
| 520 | } |
||
| 521 | |||
| 522 | /** |
||
| 523 | * Set addressOrigin |
||
| 524 | * |
||
| 525 | * @param \ControleOnline\Entity\Address $address_origin |
||
| 526 | * @return Order |
||
| 527 | */ |
||
| 528 | public function setAddressOrigin(\ControleOnline\Entity\Address $address_origin = null) |
||
| 533 | } |
||
| 534 | |||
| 535 | /** |
||
| 536 | * Get addressOrigin |
||
| 537 | * |
||
| 538 | * @return \ControleOnline\Entity\Address |
||
| 539 | */ |
||
| 540 | public function getAddressOrigin() |
||
| 541 | { |
||
| 542 | return $this->addressOrigin; |
||
| 543 | } |
||
| 544 | |||
| 545 | /** |
||
| 546 | * Set addressDestination |
||
| 547 | * |
||
| 548 | * @param \ControleOnline\Entity\Address $address_destination |
||
| 549 | * @return Order |
||
| 550 | */ |
||
| 551 | public function setAddressDestination(\ControleOnline\Entity\Address $address_destination = null) |
||
| 552 | { |
||
| 553 | $this->addressDestination = $address_destination; |
||
| 554 | |||
| 555 | return $this; |
||
| 556 | } |
||
| 557 | |||
| 558 | /** |
||
| 559 | * Get quote |
||
| 560 | * |
||
| 561 | * @return \ControleOnline\Entity\Address |
||
| 562 | */ |
||
| 563 | public function getAddressDestination() |
||
| 564 | { |
||
| 565 | return $this->addressDestination; |
||
| 566 | } |
||
| 567 | |||
| 568 | /** |
||
| 569 | * Get retrieveContact |
||
| 570 | * |
||
| 571 | * @return \ControleOnline\Entity\People |
||
| 572 | */ |
||
| 573 | public function getRetrieveContact() |
||
| 574 | { |
||
| 575 | return $this->retrieveContact; |
||
| 576 | } |
||
| 577 | |||
| 578 | /** |
||
| 579 | * Set retrieveContact |
||
| 580 | * |
||
| 581 | * @param \ControleOnline\Entity\People $retrieve_contact |
||
| 582 | * @return Order |
||
| 583 | */ |
||
| 584 | public function setRetrieveContact(\ControleOnline\Entity\People $retrieve_contact = null) |
||
| 585 | { |
||
| 586 | $this->retrieveContact = $retrieve_contact; |
||
| 587 | |||
| 588 | return $this; |
||
| 589 | } |
||
| 590 | |||
| 591 | /** |
||
| 592 | * Get deliveryContact |
||
| 593 | * |
||
| 594 | * @return \ControleOnline\Entity\People |
||
| 595 | */ |
||
| 596 | public function getDeliveryContact() |
||
| 597 | { |
||
| 598 | return $this->deliveryContact; |
||
| 599 | } |
||
| 600 | |||
| 601 | /** |
||
| 602 | * Set deliveryContact |
||
| 603 | * |
||
| 604 | * @param \ControleOnline\Entity\People $delivery_contact |
||
| 605 | * @return Order |
||
| 606 | */ |
||
| 607 | public function setDeliveryContact(\ControleOnline\Entity\People $delivery_contact = null) |
||
| 608 | { |
||
| 609 | $this->deliveryContact = $delivery_contact; |
||
| 610 | |||
| 611 | return $this; |
||
| 612 | } |
||
| 613 | |||
| 614 | /** |
||
| 615 | * Set payer |
||
| 616 | * |
||
| 617 | * @param \ControleOnline\Entity\People $payer |
||
| 618 | * @return Order |
||
| 619 | */ |
||
| 620 | public function setPayer(\ControleOnline\Entity\People $payer = null) |
||
| 621 | { |
||
| 622 | $this->payer = $payer; |
||
| 623 | |||
| 624 | return $this; |
||
| 625 | } |
||
| 626 | |||
| 627 | /** |
||
| 628 | * Get payer |
||
| 629 | * |
||
| 630 | * @return \ControleOnline\Entity\People |
||
| 631 | */ |
||
| 632 | public function getPayer() |
||
| 635 | } |
||
| 636 | |||
| 637 | |||
| 638 | /** |
||
| 639 | * Set comments |
||
| 640 | * |
||
| 641 | * @param string $comments |
||
| 642 | * @return Order |
||
| 643 | */ |
||
| 644 | public function setComments($comments) |
||
| 645 | { |
||
| 646 | $this->comments = $comments; |
||
| 647 | |||
| 648 | return $this; |
||
| 649 | } |
||
| 650 | |||
| 651 | /** |
||
| 652 | * Get comments |
||
| 653 | * |
||
| 654 | * @return string |
||
| 655 | */ |
||
| 656 | public function getComments() |
||
| 657 | { |
||
| 658 | return $this->comments; |
||
| 659 | } |
||
| 660 | |||
| 661 | /** |
||
| 662 | * Get otherInformations |
||
| 663 | * |
||
| 664 | * @return stdClass |
||
| 665 | */ |
||
| 666 | public function getOtherInformations($decode = false) |
||
| 667 | { |
||
| 668 | return $decode ? (object) json_decode((is_array($this->otherInformations) ? json_encode($this->otherInformations) : $this->otherInformations)) : $this->otherInformations; |
||
| 669 | } |
||
| 670 | |||
| 671 | /** |
||
| 672 | * Set comments |
||
| 673 | * |
||
| 674 | * @param string $otherInformations |
||
| 675 | * @return Order |
||
| 676 | */ |
||
| 677 | public function addOtherInformations($key, $value) |
||
| 678 | { |
||
| 679 | $otherInformations = $this->getOtherInformations(true); |
||
| 680 | $otherInformations->$key = $value; |
||
| 681 | $this->otherInformations = json_encode($otherInformations); |
||
| 682 | return $this; |
||
| 683 | } |
||
| 684 | |||
| 685 | /** |
||
| 686 | * Set comments |
||
| 687 | * |
||
| 688 | * @param string $otherInformations |
||
| 689 | * @return Order |
||
| 690 | */ |
||
| 691 | public function setOtherInformations($otherInformations) |
||
| 692 | { |
||
| 693 | $this->otherInformations = json_encode($otherInformations); |
||
| 694 | return $this; |
||
| 695 | } |
||
| 696 | |||
| 697 | |||
| 698 | /** |
||
| 699 | * Get orderDate |
||
| 700 | * |
||
| 701 | * @return \DateTimeInterface |
||
| 702 | */ |
||
| 703 | public function getOrderDate() |
||
| 704 | { |
||
| 705 | return $this->orderDate; |
||
| 706 | } |
||
| 707 | |||
| 708 | /** |
||
| 709 | * Set alter_date |
||
| 710 | * |
||
| 711 | * @param \DateTimeInterface $alter_date |
||
| 712 | */ |
||
| 713 | public function setAlterDate(\DateTimeInterface $alter_date = null): self |
||
| 714 | { |
||
| 715 | $this->alterDate = $alter_date; |
||
| 716 | |||
| 717 | return $this; |
||
| 718 | } |
||
| 719 | |||
| 720 | /** |
||
| 721 | * Get alter_date |
||
| 722 | * |
||
| 723 | */ |
||
| 724 | public function getAlterDate(): ?\DateTimeInterface |
||
| 725 | { |
||
| 726 | return $this->alterDate; |
||
| 727 | } |
||
| 728 | |||
| 729 | /** |
||
| 730 | * Add orderPackage |
||
| 731 | * |
||
| 732 | * @param \ControleOnline\Entity\OrderPackage $order_package |
||
| 733 | * @return Order |
||
| 734 | */ |
||
| 735 | public function addOrderPackage(\ControleOnline\Entity\OrderPackage $order_package) |
||
| 736 | { |
||
| 737 | $this->orderPackage[] = $order_package; |
||
| 738 | |||
| 739 | return $this; |
||
| 740 | } |
||
| 741 | |||
| 742 | /** |
||
| 743 | * Remove orderPackage |
||
| 744 | * |
||
| 745 | * @param \ControleOnline\Entity\OrderPackage $order_package |
||
| 746 | */ |
||
| 747 | public function removeOrderPackage(\ControleOnline\Entity\OrderPackage $order_package) |
||
| 748 | { |
||
| 749 | $this->orderPackage->removeElement($order_package); |
||
| 750 | } |
||
| 751 | |||
| 752 | /** |
||
| 753 | * Get orderPackage |
||
| 754 | * |
||
| 755 | * @return \Doctrine\Common\Collections\Collection |
||
| 756 | */ |
||
| 757 | public function getOrderPackage() |
||
| 758 | { |
||
| 759 | return $this->orderPackage; |
||
| 760 | } |
||
| 761 | |||
| 762 | /** |
||
| 763 | * Add invoiceTax |
||
| 764 | * |
||
| 765 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
| 766 | * @return Order |
||
| 767 | */ |
||
| 768 | public function addAInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
| 769 | { |
||
| 770 | $this->invoiceTax[] = $invoice_tax; |
||
| 771 | |||
| 772 | return $this; |
||
| 773 | } |
||
| 774 | |||
| 775 | /** |
||
| 776 | * Remove invoiceTax |
||
| 777 | * |
||
| 778 | * @param \ControleOnline\Entity\OrderInvoiceTax $invoice_tax |
||
| 779 | */ |
||
| 780 | public function removeInvoiceTax(OrderInvoiceTax $invoice_tax) |
||
| 781 | { |
||
| 782 | $this->invoiceTax->removeElement($invoice_tax); |
||
| 783 | } |
||
| 784 | |||
| 785 | /** |
||
| 786 | * Get invoiceTax |
||
| 787 | * |
||
| 788 | * @return \Doctrine\Common\Collections\Collection |
||
| 789 | */ |
||
| 790 | public function getInvoiceTax() |
||
| 791 | { |
||
| 792 | return $this->invoiceTax; |
||
| 793 | } |
||
| 794 | |||
| 795 | |||
| 796 | |||
| 797 | /** |
||
| 798 | * Get invoiceTax |
||
| 799 | * |
||
| 800 | * @return \ControleOnline\Entity\InvoiceTax |
||
| 801 | */ |
||
| 802 | public function getClientInvoiceTax() |
||
| 803 | { |
||
| 804 | foreach ($this->getInvoiceTax() as $invoice) { |
||
| 805 | if ($invoice->getInvoiceType() == 55) { |
||
| 806 | return $invoice; |
||
| 807 | } |
||
| 808 | } |
||
| 809 | } |
||
| 810 | |||
| 811 | |||
| 812 | /** |
||
| 813 | * Get invoiceTax |
||
| 814 | * |
||
| 815 | * @return \ControleOnline\Entity\InvoiceTax |
||
| 816 | */ |
||
| 817 | public function getCarrierInvoiceTax() |
||
| 818 | { |
||
| 819 | foreach ($this->getInvoiceTax() as $invoice) { |
||
| 820 | if ($invoice->getInvoiceType() == 57) { |
||
| 821 | return $invoice->getInvoiceTax(); |
||
| 822 | } |
||
| 823 | } |
||
| 824 | } |
||
| 825 | |||
| 826 | /** |
||
| 827 | * Add OrderInvoice |
||
| 828 | * |
||
| 829 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
| 830 | * @return People |
||
| 831 | */ |
||
| 832 | public function addInvoice(OrderInvoice $invoice) |
||
| 833 | { |
||
| 834 | $this->invoice[] = $invoice; |
||
| 835 | |||
| 836 | return $this; |
||
| 837 | } |
||
| 838 | |||
| 839 | /** |
||
| 840 | * Remove OrderInvoice |
||
| 841 | * |
||
| 842 | * @param \ControleOnline\Entity\OrderInvoice $invoice |
||
| 843 | */ |
||
| 844 | public function removeInvoice(OrderInvoice $invoice) |
||
| 845 | { |
||
| 846 | $this->invoice->removeElement($invoice); |
||
| 847 | } |
||
| 848 | |||
| 849 | /** |
||
| 850 | * Get OrderInvoice |
||
| 851 | * |
||
| 852 | * @return \Doctrine\Common\Collections\Collection |
||
| 853 | */ |
||
| 854 | public function getInvoice() |
||
| 855 | { |
||
| 856 | return $this->invoice; |
||
| 857 | } |
||
| 858 | |||
| 859 | /** |
||
| 860 | * Add quotes |
||
| 861 | * |
||
| 862 | * @param \ControleOnline\Entity\Quotation $quotes |
||
| 863 | * @return Order |
||
| 864 | */ |
||
| 865 | public function addAQuotes(\ControleOnline\Entity\Quotation $quotes) |
||
| 866 | { |
||
| 867 | $this->quotes[] = $quotes; |
||
| 868 | |||
| 869 | return $this; |
||
| 870 | } |
||
| 871 | |||
| 872 | /** |
||
| 873 | * Remove quotes |
||
| 874 | * |
||
| 875 | * @param \ControleOnline\Entity\Quotation $quotes |
||
| 876 | */ |
||
| 877 | public function removeQuotes(\ControleOnline\Entity\Quotation $quotes) |
||
| 878 | { |
||
| 879 | $this->quotes->removeElement($quotes); |
||
| 880 | } |
||
| 881 | |||
| 882 | /** |
||
| 883 | * Get quotes |
||
| 884 | * |
||
| 885 | * @return \Doctrine\Common\Collections\Collection |
||
| 886 | */ |
||
| 887 | public function getQuotes() |
||
| 888 | { |
||
| 889 | return $this->quotes; |
||
| 890 | } |
||
| 891 | |||
| 892 | /** |
||
| 893 | * Add retrieves |
||
| 894 | * |
||
| 895 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
| 896 | * @return Order |
||
| 897 | */ |
||
| 898 | public function addARetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
| 899 | { |
||
| 900 | $this->retrieves[] = $retrieves; |
||
| 901 | |||
| 902 | return $this; |
||
| 903 | } |
||
| 904 | |||
| 905 | /** |
||
| 906 | * Remove retrieves |
||
| 907 | * |
||
| 908 | * @param \ControleOnline\Entity\Retrieve $retrieves |
||
| 909 | */ |
||
| 910 | public function removeRetrieves(\ControleOnline\Entity\Retrieve $retrieves) |
||
| 911 | { |
||
| 912 | $this->retrieves->removeElement($retrieves); |
||
| 913 | } |
||
| 914 | |||
| 915 | /** |
||
| 916 | * Get retrieves |
||
| 917 | * |
||
| 918 | * @return \Doctrine\Common\Collections\Collection |
||
| 919 | */ |
||
| 920 | public function getRetrieves() |
||
| 921 | { |
||
| 922 | return $this->retrieves; |
||
| 923 | } |
||
| 924 | |||
| 925 | /** |
||
| 926 | * Get Notified |
||
| 927 | * |
||
| 928 | * @return boolean |
||
| 929 | */ |
||
| 930 | public function getNotified() |
||
| 931 | { |
||
| 932 | return $this->notified; |
||
| 933 | } |
||
| 934 | |||
| 935 | /** |
||
| 936 | * Set Notified |
||
| 937 | * |
||
| 938 | * @param boolean $notified |
||
| 939 | * @return People |
||
| 940 | */ |
||
| 941 | public function setNotified($notified) |
||
| 942 | { |
||
| 943 | $this->notified = $notified ? 1 : 0; |
||
| 944 | |||
| 945 | return $this; |
||
| 946 | } |
||
| 947 | |||
| 948 | /** |
||
| 949 | * Set orderType |
||
| 950 | * |
||
| 951 | * @param string $orderType |
||
| 952 | * @return Order |
||
| 953 | */ |
||
| 954 | public function setOrderType($order_type) |
||
| 955 | { |
||
| 956 | $this->orderType = $order_type; |
||
| 957 | |||
| 958 | return $this; |
||
| 959 | } |
||
| 960 | |||
| 961 | /** |
||
| 962 | * Get orderType |
||
| 963 | * |
||
| 964 | * @return string |
||
| 965 | */ |
||
| 966 | public function getOrderType() |
||
| 967 | { |
||
| 968 | return $this->orderType; |
||
| 969 | } |
||
| 970 | |||
| 971 | /** |
||
| 972 | * Set app |
||
| 973 | * |
||
| 974 | * @param string $app |
||
| 975 | * @return Order |
||
| 976 | */ |
||
| 977 | public function setApp($app) |
||
| 978 | { |
||
| 979 | $this->app = $app; |
||
| 980 | |||
| 981 | return $this; |
||
| 982 | } |
||
| 983 | |||
| 984 | /** |
||
| 985 | * Get app |
||
| 986 | * |
||
| 987 | * @return string |
||
| 988 | */ |
||
| 989 | public function getApp() |
||
| 990 | { |
||
| 991 | return $this->app; |
||
| 992 | } |
||
| 993 | |||
| 994 | |||
| 995 | |||
| 996 | /** |
||
| 997 | * Set mainOrder |
||
| 998 | * |
||
| 999 | * @param \ControleOnline\Entity\Order $mainOrder |
||
| 1000 | * @return Order |
||
| 1001 | */ |
||
| 1002 | public function setMainOrder(\ControleOnline\Entity\Order $main_order = null) |
||
| 1003 | { |
||
| 1004 | $this->mainOrder = $main_order; |
||
| 1005 | |||
| 1006 | return $this; |
||
| 1007 | } |
||
| 1008 | |||
| 1009 | /** |
||
| 1010 | * Get mainOrder |
||
| 1011 | * |
||
| 1012 | * @return \ControleOnline\Entity\Order |
||
| 1013 | */ |
||
| 1014 | public function getMainOrder() |
||
| 1015 | { |
||
| 1016 | return $this->mainOrder; |
||
| 1017 | } |
||
| 1018 | |||
| 1019 | /** |
||
| 1020 | * Set mainOrderId |
||
| 1021 | * |
||
| 1022 | * @param integer $mainOrderId |
||
| 1023 | * @return Order |
||
| 1024 | */ |
||
| 1025 | public function setMainOrderId($mainOrderId) |
||
| 1026 | { |
||
| 1027 | $this->mainOrderId = $mainOrderId; |
||
| 1028 | |||
| 1029 | return $this; |
||
| 1030 | } |
||
| 1031 | |||
| 1032 | /** |
||
| 1033 | * Get mainOrderId |
||
| 1034 | * |
||
| 1035 | * @return integer |
||
| 1036 | */ |
||
| 1037 | public function getMainOrderId() |
||
| 1038 | { |
||
| 1039 | return $this->mainOrderId; |
||
| 1040 | } |
||
| 1041 | |||
| 1042 | |||
| 1043 | |||
| 1044 | public function getInvoiceByStatus(array $status) |
||
| 1045 | { |
||
| 1046 | foreach ($this->getInvoice() as $purchasingOrderInvoice) { |
||
| 1047 | $invoice = $purchasingOrderInvoice->getInvoice(); |
||
| 1048 | if (in_array($invoice->getStatus()->getStatus(), $status)) { |
||
| 1049 | return $invoice; |
||
| 1050 | } |
||
| 1051 | } |
||
| 1052 | } |
||
| 1053 | |||
| 1054 | |||
| 1055 | public function canAccess($currentUser): bool |
||
| 1056 | { |
||
| 1057 | if (($provider = $this->getProvider()) === null) |
||
| 1058 | return false; |
||
| 1059 | |||
| 1060 | return $currentUser->getPeople()->getLink()->exists( |
||
| 1061 | function ($key, $element) use ($provider) { |
||
| 1062 | return $element->getCompany() === $provider; |
||
| 1063 | } |
||
| 1064 | ); |
||
| 1065 | } |
||
| 1066 | |||
| 1067 | public function justOpened(): bool |
||
| 1068 | { |
||
| 1069 | return $this->getStatus()->getStatus() == 'quote'; |
||
| 1070 | } |
||
| 1071 | |||
| 1072 | /** |
||
| 1073 | * Get tracking |
||
| 1074 | * |
||
| 1075 | * @return \Doctrine\Common\Collections\Collection |
||
| 1076 | */ |
||
| 1077 | public function getTracking() |
||
| 1078 | { |
||
| 1079 | return $this->tracking; |
||
| 1080 | } |
||
| 1081 | |||
| 1082 | public function getOneInvoice() |
||
| 1083 | { |
||
| 1084 | return (($invoiceOrders = $this->getInvoice()->first()) === false) ? |
||
| 1085 | null : $invoiceOrders->getInvoice(); |
||
| 1086 | } |
||
| 1087 | |||
| 1088 | /** |
||
| 1089 | * Add Task |
||
| 1090 | * |
||
| 1091 | * @param \ControleOnline\Entity\Task $task |
||
| 1092 | * @return Order |
||
| 1093 | */ |
||
| 1094 | public function addTask(\ControleOnline\Entity\Task $task) |
||
| 1095 | { |
||
| 1096 | $this->task[] = $task; |
||
| 1097 | |||
| 1098 | return $this; |
||
| 1099 | } |
||
| 1100 | |||
| 1101 | /** |
||
| 1102 | * Remove Task |
||
| 1103 | * |
||
| 1104 | * @param \ControleOnline\Entity\Task $task |
||
| 1105 | */ |
||
| 1106 | public function removeTask(\ControleOnline\Entity\Task $task) |
||
| 1107 | { |
||
| 1108 | $this->task->removeElement($task); |
||
| 1109 | } |
||
| 1110 | |||
| 1111 | /** |
||
| 1112 | * Get Task |
||
| 1113 | * |
||
| 1114 | * @return \Doctrine\Common\Collections\Collection |
||
| 1115 | */ |
||
| 1116 | public function getTask() |
||
| 1117 | { |
||
| 1118 | return $this->task; |
||
| 1119 | } |
||
| 1120 | |||
| 1121 | /** |
||
| 1122 | * Add OrderQueue |
||
| 1123 | * |
||
| 1124 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
| 1125 | * @return Order |
||
| 1126 | */ |
||
| 1127 | public function addAOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
| 1128 | { |
||
| 1129 | $this->orderQueue[] = $orderQueue; |
||
| 1130 | |||
| 1131 | return $this; |
||
| 1132 | } |
||
| 1133 | |||
| 1134 | /** |
||
| 1135 | * Remove OrderQueue |
||
| 1136 | * |
||
| 1137 | * @param \ControleOnline\Entity\OrderQueue $invoice_tax |
||
| 1138 | */ |
||
| 1139 | public function removeOrderQueue(\ControleOnline\Entity\OrderQueue $orderQueue) |
||
| 1140 | { |
||
| 1141 | $this->orderQueue->removeElement($orderQueue); |
||
| 1142 | } |
||
| 1143 | |||
| 1144 | /** |
||
| 1145 | * Get OrderQueue |
||
| 1146 | * |
||
| 1147 | * @return \Doctrine\Common\Collections\Collection |
||
| 1148 | */ |
||
| 1149 | public function getOrderQueue() |
||
| 1150 | { |
||
| 1151 | return $this->orderQueue; |
||
| 1152 | } |
||
| 1153 | |||
| 1154 | public function isOriginAndDestinationTheSame(): ?bool |
||
| 1174 | } |
||
| 1175 | |||
| 1176 | public function isOriginAndDestinationTheSameState(): ?bool |
||
| 1177 | { |
||
| 1178 | if (($origin = $this->getAddressOrigin()) === null) { |
||
| 1179 | return null; |
||
| 1180 | } |
||
| 1181 | |||
| 1182 | if (($destination = $this->getAddressDestination()) === null) { |
||
| 1183 | return null; |
||
| 1184 | } |
||
| 1185 | |||
| 1186 | $origState = $origin->getStreet()->getDistrict()->getCity()->getState(); |
||
| 1187 | $destState = $destination->getStreet()->getDistrict()->getCity()->getState(); |
||
| 1188 | |||
| 1189 | // both objects are the same entity ( = same name and same country) |
||
| 1190 | |||
| 1191 | if ($origState === $destState) { |
||
| 1192 | return true; |
||
| 1193 | } |
||
| 1194 | |||
| 1195 | return false; |
||
| 1196 | } |
||
| 1197 | |||
| 1198 | |||
| 1199 | public function getOrderProducts() |
||
| 1200 | { |
||
| 1201 | return $this->orderProducts; |
||
| 1202 | } |
||
| 1203 | |||
| 1204 | public function addOrderProduct(OrderProduct $orderProduct): self |
||
| 1208 | } |
||
| 1209 | |||
| 1210 | public function removeOrderProduct(OrderProduct $orderProduct): self |
||
| 1211 | { |
||
| 1212 | $this->orderProducts->removeElement($orderProduct); |
||
| 1213 | return $this; |
||
| 1214 | } |
||
| 1215 | } |
||
| 1216 |
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