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
PackageCustomer.php
176 lines
| 1 | <?php |
| 2 | /** |
| 3 | * @copyright © TMS-Plugins. All rights reserved. |
| 4 | * @licence See LICENCE.md for license details. |
| 5 | */ |
| 6 | |
| 7 | namespace AmeliaBooking\Domain\Entity\Bookable\Service; |
| 8 | |
| 9 | use AmeliaBooking\Domain\Collection\Collection; |
| 10 | use AmeliaBooking\Domain\Entity\Booking\AbstractCustomerBooking; |
| 11 | use AmeliaBooking\Domain\ValueObjects\DateTime\DateTimeValue; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 13 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\WholeNumber; |
| 14 | |
| 15 | /** |
| 16 | * Class PackageCustomer |
| 17 | * |
| 18 | * @package AmeliaBooking\Domain\Entity\Bookable\Service |
| 19 | */ |
| 20 | class PackageCustomer extends AbstractCustomerBooking |
| 21 | { |
| 22 | /** @var Id */ |
| 23 | private $id; |
| 24 | |
| 25 | /** @var Id */ |
| 26 | private $packageId; |
| 27 | |
| 28 | /** @var DateTimeValue */ |
| 29 | private $end; |
| 30 | |
| 31 | /** @var DateTimeValue */ |
| 32 | private $start; |
| 33 | |
| 34 | /** @var DateTimeValue */ |
| 35 | private $purchased; |
| 36 | |
| 37 | /** @var Collection */ |
| 38 | private $payments; |
| 39 | |
| 40 | /** @var WholeNumber */ |
| 41 | private $bookingsCount; |
| 42 | |
| 43 | /** |
| 44 | * @return Id |
| 45 | */ |
| 46 | public function getId() |
| 47 | { |
| 48 | return $this->id; |
| 49 | } |
| 50 | |
| 51 | /** |
| 52 | * @param Id $id |
| 53 | */ |
| 54 | public function setId(Id $id) |
| 55 | { |
| 56 | $this->id = $id; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @return Id |
| 61 | */ |
| 62 | public function getPackageId() |
| 63 | { |
| 64 | return $this->packageId; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @param Id $packageId |
| 69 | */ |
| 70 | public function setPackageId(Id $packageId) |
| 71 | { |
| 72 | $this->packageId = $packageId; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @return Collection |
| 77 | */ |
| 78 | public function getPayments() |
| 79 | { |
| 80 | return $this->payments; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @param Collection $payments |
| 85 | */ |
| 86 | public function setPayments(Collection $payments) |
| 87 | { |
| 88 | $this->payments = $payments; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @return DateTimeValue |
| 93 | */ |
| 94 | public function getEnd() |
| 95 | { |
| 96 | return $this->end; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @param DateTimeValue $end |
| 101 | */ |
| 102 | public function setEnd(DateTimeValue $end) |
| 103 | { |
| 104 | $this->end = $end; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @return DateTimeValue |
| 109 | */ |
| 110 | public function getStart() |
| 111 | { |
| 112 | return $this->start; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @param DateTimeValue $start |
| 117 | */ |
| 118 | public function setStart(DateTimeValue $start) |
| 119 | { |
| 120 | $this->start = $start; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * @return DateTimeValue |
| 125 | */ |
| 126 | public function getPurchased() |
| 127 | { |
| 128 | return $this->purchased; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @param DateTimeValue $purchased |
| 133 | */ |
| 134 | public function setPurchased(DateTimeValue $purchased) |
| 135 | { |
| 136 | $this->purchased = $purchased; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * @return WholeNumber |
| 141 | */ |
| 142 | public function getBookingsCount() |
| 143 | { |
| 144 | return $this->bookingsCount; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * @param WholeNumber $bookingsCount |
| 149 | */ |
| 150 | public function setBookingsCount(WholeNumber $bookingsCount) |
| 151 | { |
| 152 | $this->bookingsCount = $bookingsCount; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @return array |
| 157 | */ |
| 158 | public function toArray() |
| 159 | { |
| 160 | $dateTimeFormat = 'Y-m-d H:i:s'; |
| 161 | |
| 162 | return array_merge( |
| 163 | parent::toArray(), |
| 164 | [ |
| 165 | 'packageId' => $this->getPackageId() ? $this->getPackageId()->getValue() : null, |
| 166 | 'payments' => $this->getPayments() ? $this->getPayments()->toArray() : null, |
| 167 | 'start' => $this->getStart() ? $this->getStart()->getValue()->format($dateTimeFormat) : null, |
| 168 | 'end' => $this->getEnd() ? $this->getEnd()->getValue()->format($dateTimeFormat) : null, |
| 169 | 'purchased' => $this->getPurchased() ? |
| 170 | $this->getPurchased()->getValue()->format($dateTimeFormat) : null, |
| 171 | 'bookingsCount' => $this->getBookingsCount() ? $this->getBookingsCount()->getValue() : null, |
| 172 | ] |
| 173 | ); |
| 174 | } |
| 175 | } |
| 176 |