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