|
- <?php
-
- namespace domain\PointSale\SharedPointSale;
-
- use domain\_\AbstractBuilder;
- use domain\_\StatusInterface;
- use domain\PointSale\PointSale\PointSale;
- use domain\Producer\Producer\Producer;
- use domain\User\User\User;
-
- class SharedPointSaleBuilder extends AbstractBuilder
- {
- public function instanciateSharedPointSale(PointSale $pointSale = null, Producer $producerWithSharing = null, User $createdBy = null): SharedPointSale
- {
- $sharedPointSale = new SharedPointSale();
-
- if($pointSale) {
- $sharedPointSale->setPointSale($pointSale);
- }
-
- if($producerWithSharing) {
- $sharedPointSale->setProducerWithSharing($producerWithSharing);
- }
-
- if($createdBy) {
- $sharedPointSale->setCreatedBy($createdBy);
- }
-
- $sharedPointSale->setCreatedAt(new \DateTime());
- $sharedPointSale->setStatus(StatusInterface::STATUS_ONLINE);
-
- return $sharedPointSale;
- }
-
- public function initConfirmSharedPointSale(SharedPointSale $sharedPointSale, PointSale $pointSaleWithSharing, User $confirmedBy)
- {
- $sharedPointSale->setPointSaleWithSharing($pointSaleWithSharing);
- $sharedPointSale->setConfirmedBy($confirmedBy);
- $sharedPointSale->setConfirmedAt(new \DateTime());
- }
-
- public function initDeclineSharedPointSale(SharedPointSale $sharedPointSale, User $declinedBy)
- {
- $sharedPointSale->setStatus(StatusInterface::STATUS_OFFLINE);
- $sharedPointSale->setDeclinedBy($declinedBy);
- $sharedPointSale->setDeclinedAt(new \DateTime());
- }
- }
|