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