Du kannst nicht mehr als 25 Themen auswählen Themen müssen entweder mit einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

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