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