Appointment
2 months ago
Event
2 months ago
AbstractBooking.php
2 months ago
AbstractCustomerBooking.php
2 weeks ago
Reservation.php
6 months ago
SlotsEntities.php
6 months ago
AbstractCustomerBooking.php
213 lines
| 1 | <?php |
| 2 | |
| 3 | /** |
| 4 | * @copyright © Melograno Ventures. All rights reserved. |
| 5 | * @licence See LICENCE.md for license details. |
| 6 | */ |
| 7 | |
| 8 | namespace AmeliaBooking\Domain\Entity\Booking; |
| 9 | |
| 10 | use AmeliaBooking\Domain\Entity\Coupon\Coupon; |
| 11 | use AmeliaBooking\Domain\Entity\User\Customer; |
| 12 | use AmeliaBooking\Domain\ValueObjects\Json; |
| 13 | use AmeliaBooking\Domain\ValueObjects\Number\Float\Price; |
| 14 | use AmeliaBooking\Domain\ValueObjects\String\BookingStatus; |
| 15 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 16 | |
| 17 | /** |
| 18 | * Class AbstractCustomerBooking |
| 19 | * |
| 20 | * @package AmeliaBooking\Domain\Entity\Booking |
| 21 | */ |
| 22 | abstract class AbstractCustomerBooking |
| 23 | { |
| 24 | /** @var Id */ |
| 25 | private $id; |
| 26 | |
| 27 | /** @var Id */ |
| 28 | protected $customerId; |
| 29 | |
| 30 | /** @var Customer */ |
| 31 | protected $customer; |
| 32 | |
| 33 | /** @var BookingStatus */ |
| 34 | protected $status; |
| 35 | |
| 36 | /** @var Id */ |
| 37 | protected $couponId; |
| 38 | |
| 39 | /** @var Price */ |
| 40 | protected $price; |
| 41 | |
| 42 | /** @var Coupon */ |
| 43 | protected $coupon; |
| 44 | |
| 45 | /** @var Json */ |
| 46 | protected $tax; |
| 47 | |
| 48 | /** @var Id */ |
| 49 | protected $ivyEntryId; |
| 50 | |
| 51 | /** |
| 52 | * @return Id |
| 53 | */ |
| 54 | public function getId() |
| 55 | { |
| 56 | return $this->id; |
| 57 | } |
| 58 | |
| 59 | /** |
| 60 | * @param Id $id |
| 61 | */ |
| 62 | public function setId(Id $id) |
| 63 | { |
| 64 | $this->id = $id; |
| 65 | } |
| 66 | |
| 67 | /** |
| 68 | * @return Id |
| 69 | */ |
| 70 | public function getCustomerId() |
| 71 | { |
| 72 | return $this->customerId; |
| 73 | } |
| 74 | |
| 75 | /** |
| 76 | * @param Id $customerId |
| 77 | */ |
| 78 | public function setCustomerId(Id $customerId) |
| 79 | { |
| 80 | $this->customerId = $customerId; |
| 81 | } |
| 82 | |
| 83 | /** |
| 84 | * @return Customer |
| 85 | */ |
| 86 | public function getCustomer() |
| 87 | { |
| 88 | return $this->customer; |
| 89 | } |
| 90 | |
| 91 | /** |
| 92 | * @param Customer $customer |
| 93 | */ |
| 94 | public function setCustomer(Customer $customer) |
| 95 | { |
| 96 | $this->customer = $customer; |
| 97 | } |
| 98 | |
| 99 | /** |
| 100 | * @return BookingStatus |
| 101 | */ |
| 102 | public function getStatus() |
| 103 | { |
| 104 | return $this->status; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @param BookingStatus $status |
| 109 | */ |
| 110 | public function setStatus(BookingStatus $status) |
| 111 | { |
| 112 | $this->status = $status; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return Id |
| 117 | */ |
| 118 | public function getCouponId() |
| 119 | { |
| 120 | return $this->couponId; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * @param Id $couponId |
| 125 | */ |
| 126 | public function setCouponId(Id $couponId) |
| 127 | { |
| 128 | $this->couponId = $couponId; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @return Coupon |
| 133 | */ |
| 134 | public function getCoupon() |
| 135 | { |
| 136 | return $this->coupon; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * @param Coupon $coupon |
| 141 | */ |
| 142 | public function setCoupon(Coupon $coupon) |
| 143 | { |
| 144 | $this->coupon = $coupon; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * @return Price |
| 149 | */ |
| 150 | public function getPrice() |
| 151 | { |
| 152 | return $this->price; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @param Price $price |
| 157 | */ |
| 158 | public function setPrice(Price $price) |
| 159 | { |
| 160 | $this->price = $price; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * @return Json |
| 165 | */ |
| 166 | public function getTax() |
| 167 | { |
| 168 | return $this->tax; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * @param Json $tax |
| 173 | */ |
| 174 | public function setTax(Json $tax) |
| 175 | { |
| 176 | $this->tax = $tax; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * @return Id |
| 181 | */ |
| 182 | public function getIvyEntryId() |
| 183 | { |
| 184 | return $this->ivyEntryId; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * @param Id $ivyEntryId |
| 189 | */ |
| 190 | public function setIvyEntryId(Id $ivyEntryId) |
| 191 | { |
| 192 | $this->ivyEntryId = $ivyEntryId; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * @return array |
| 197 | */ |
| 198 | public function toArray() |
| 199 | { |
| 200 | return [ |
| 201 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 202 | 'customerId' => null !== $this->getCustomerId() ? $this->getCustomerId()->getValue() : null, |
| 203 | 'customer' => null !== $this->getCustomer() ? $this->getCustomer()->toArray() : null, |
| 204 | 'status' => null !== $this->getStatus() ? $this->getStatus()->getValue() : null, |
| 205 | 'couponId' => null !== $this->getCouponId() ? $this->getCouponId()->getValue() : null, |
| 206 | 'price' => null !== $this->getPrice() ? $this->getPrice()->getValue() : null, |
| 207 | 'coupon' => null !== $this->getCoupon() ? $this->getCoupon()->toArray() : null, |
| 208 | 'tax' => null !== $this->getTax() ? json_decode($this->getTax()->getValue(), true) : null, |
| 209 | 'ivyEntryId' => null !== $this->getIvyEntryId() ? $this->getIvyEntryId()->getValue() : null, |
| 210 | ]; |
| 211 | } |
| 212 | } |
| 213 |