Category.php
1 year ago
Extra.php
1 year ago
Package.php
6 months ago
PackageCustomer.php
6 months ago
PackageCustomerService.php
6 months ago
PackageService.php
6 months ago
Resource.php
6 months ago
Service.php
6 months ago
Extra.php
120 lines
| 1 | <?php |
| 2 | |
| 3 | namespace AmeliaBooking\Domain\Entity\Bookable\Service; |
| 4 | |
| 5 | use AmeliaBooking\Domain\Entity\Bookable\AbstractExtra; |
| 6 | use AmeliaBooking\Domain\Entity\Entities; |
| 7 | use AmeliaBooking\Domain\ValueObjects\BooleanValueObject; |
| 8 | use AmeliaBooking\Domain\ValueObjects\Json; |
| 9 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 10 | use AmeliaBooking\Domain\ValueObjects\Duration; |
| 11 | use AmeliaBooking\Domain\ValueObjects\String\BookableType; |
| 12 | |
| 13 | /** |
| 14 | * Class Extra |
| 15 | * |
| 16 | * @package AmeliaBooking\Domain\Entity\Bookable\Service |
| 17 | */ |
| 18 | class Extra extends AbstractExtra |
| 19 | { |
| 20 | /** @var Duration */ |
| 21 | private $duration; |
| 22 | |
| 23 | /** @var Id */ |
| 24 | private $serviceId; |
| 25 | |
| 26 | /** @var BooleanValueObject */ |
| 27 | protected $aggregatedPrice; |
| 28 | |
| 29 | /** @var Json */ |
| 30 | private $translations; |
| 31 | |
| 32 | /** |
| 33 | * @return Duration |
| 34 | */ |
| 35 | public function getDuration() |
| 36 | { |
| 37 | return $this->duration; |
| 38 | } |
| 39 | |
| 40 | /** |
| 41 | * @param Duration $duration |
| 42 | */ |
| 43 | public function setDuration(Duration $duration) |
| 44 | { |
| 45 | $this->duration = $duration; |
| 46 | } |
| 47 | |
| 48 | /** |
| 49 | * @return Id |
| 50 | */ |
| 51 | public function getServiceId() |
| 52 | { |
| 53 | return $this->serviceId; |
| 54 | } |
| 55 | |
| 56 | /** |
| 57 | * @param Id $serviceId |
| 58 | */ |
| 59 | public function setServiceId(Id $serviceId) |
| 60 | { |
| 61 | $this->serviceId = $serviceId; |
| 62 | } |
| 63 | |
| 64 | /** |
| 65 | * @return BooleanValueObject |
| 66 | */ |
| 67 | public function getAggregatedPrice() |
| 68 | { |
| 69 | return $this->aggregatedPrice; |
| 70 | } |
| 71 | |
| 72 | /** |
| 73 | * @param BooleanValueObject $aggregatedPrice |
| 74 | */ |
| 75 | public function setAggregatedPrice(BooleanValueObject $aggregatedPrice) |
| 76 | { |
| 77 | $this->aggregatedPrice = $aggregatedPrice; |
| 78 | } |
| 79 | |
| 80 | /** |
| 81 | * @return Json |
| 82 | */ |
| 83 | public function getTranslations() |
| 84 | { |
| 85 | return $this->translations; |
| 86 | } |
| 87 | |
| 88 | /** |
| 89 | * @param Json $translations |
| 90 | */ |
| 91 | public function setTranslations(Json $translations) |
| 92 | { |
| 93 | $this->translations = $translations; |
| 94 | } |
| 95 | |
| 96 | /** |
| 97 | * @return BookableType |
| 98 | */ |
| 99 | public function getType() |
| 100 | { |
| 101 | return new BookableType(Entities::EXTRA); |
| 102 | } |
| 103 | |
| 104 | /** |
| 105 | * @return array |
| 106 | */ |
| 107 | public function toArray() |
| 108 | { |
| 109 | return array_merge( |
| 110 | parent::toArray(), |
| 111 | [ |
| 112 | 'duration' => $this->getDuration() ? $this->getDuration()->getValue() : null, |
| 113 | 'serviceId' => $this->getServiceId() ? $this->getServiceId()->getValue() : null, |
| 114 | 'aggregatedPrice' => $this->getAggregatedPrice() ? $this->getAggregatedPrice()->getValue() : null, |
| 115 | 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null, |
| 116 | ] |
| 117 | ); |
| 118 | } |
| 119 | } |
| 120 |