Вы не можете выбрать более 25 тем Темы должны начинаться с буквы или цифры, могут содержать дефисы(-) и должны содержать не более 35 символов.

SharedPointSaleBuilder.php 1.6KB

7 месяцев назад
7 месяцев назад
7 месяцев назад
7 месяцев назад
7 месяцев назад
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. namespace domain\PointSale\SharedPointSale;
  3. use domain\_\AbstractBuilder;
  4. use domain\_\StatusInterface;
  5. use domain\PointSale\PointSale\PointSale;
  6. use domain\Producer\Producer\Producer;
  7. use domain\User\User\User;
  8. class SharedPointSaleBuilder extends AbstractBuilder
  9. {
  10. public function instanciateSharedPointSale(PointSale $pointSale = null, Producer $producerWithSharing = null, User $createdBy = null): SharedPointSale
  11. {
  12. $sharedPointSale = new SharedPointSale();
  13. if($pointSale) {
  14. $sharedPointSale->setPointSale($pointSale);
  15. }
  16. if($producerWithSharing) {
  17. $sharedPointSale->setProducerWithSharing($producerWithSharing);
  18. }
  19. if($createdBy) {
  20. $sharedPointSale->setCreatedBy($createdBy);
  21. }
  22. $sharedPointSale->setCreatedAt(new \DateTime());
  23. $sharedPointSale->setStatus(StatusInterface::STATUS_ONLINE);
  24. return $sharedPointSale;
  25. }
  26. public function initConfirmSharedPointSale(SharedPointSale $sharedPointSale, PointSale $pointSaleWithSharing, User $confirmedBy)
  27. {
  28. $sharedPointSale->setPointSaleWithSharing($pointSaleWithSharing);
  29. $sharedPointSale->setConfirmedBy($confirmedBy);
  30. $sharedPointSale->setConfirmedAt(new \DateTime());
  31. }
  32. public function initDeclineSharedPointSale(SharedPointSale $sharedPointSale, User $declinedBy)
  33. {
  34. $sharedPointSale->setStatus(StatusInterface::STATUS_OFFLINE);
  35. $sharedPointSale->setDeclinedBy($declinedBy);
  36. $sharedPointSale->setDeclinedAt(new \DateTime());
  37. }
  38. }