Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

48 rindas
1.6KB

  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. }