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
AbstractBooking.php
139 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\Collection\Collection; |
| 10 | use AmeliaBooking\Domain\ValueObjects\String\BookingStatus; |
| 11 | use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id; |
| 12 | use AmeliaBooking\Domain\ValueObjects\String\Description; |
| 13 | |
| 14 | /** |
| 15 | * Class AbstractBooking |
| 16 | * |
| 17 | * @package AmeliaBooking\Domain\Entity\Booking |
| 18 | */ |
| 19 | abstract class AbstractBooking |
| 20 | { |
| 21 | /** @var Id */ |
| 22 | private $id; |
| 23 | |
| 24 | /** @var Collection */ |
| 25 | protected $bookings; |
| 26 | |
| 27 | /** @var bool */ |
| 28 | protected $notifyParticipants; |
| 29 | |
| 30 | /** @var Description */ |
| 31 | protected $internalNotes; |
| 32 | |
| 33 | /** @var BookingStatus */ |
| 34 | protected $status; |
| 35 | |
| 36 | /** |
| 37 | * AbstractBooking constructor. |
| 38 | * |
| 39 | * @param boolean $notifyParticipants |
| 40 | */ |
| 41 | public function __construct($notifyParticipants) { |
| 42 | $this->notifyParticipants = $notifyParticipants; |
| 43 | } |
| 44 | |
| 45 | /** |
| 46 | * @return Id |
| 47 | */ |
| 48 | public function getId() |
| 49 | { |
| 50 | return $this->id; |
| 51 | } |
| 52 | |
| 53 | /** |
| 54 | * @param Id $id |
| 55 | */ |
| 56 | public function setId(Id $id) |
| 57 | { |
| 58 | $this->id = $id; |
| 59 | } |
| 60 | |
| 61 | /** |
| 62 | * @return Collection |
| 63 | */ |
| 64 | public function getBookings() |
| 65 | { |
| 66 | return $this->bookings; |
| 67 | } |
| 68 | |
| 69 | /** |
| 70 | * @param Collection $bookings |
| 71 | */ |
| 72 | public function setBookings(Collection $bookings) |
| 73 | { |
| 74 | $this->bookings = $bookings; |
| 75 | } |
| 76 | |
| 77 | /** |
| 78 | * @return bool |
| 79 | */ |
| 80 | public function isNotifyParticipants() |
| 81 | { |
| 82 | return $this->notifyParticipants; |
| 83 | } |
| 84 | |
| 85 | /** |
| 86 | * @param bool $notifyParticipants |
| 87 | */ |
| 88 | public function setNotifyParticipants($notifyParticipants) |
| 89 | { |
| 90 | $this->notifyParticipants = $notifyParticipants; |
| 91 | } |
| 92 | |
| 93 | /** |
| 94 | * @return Description |
| 95 | */ |
| 96 | public function getInternalNotes() |
| 97 | { |
| 98 | return $this->internalNotes; |
| 99 | } |
| 100 | |
| 101 | /** |
| 102 | * @param Description $internalNotes |
| 103 | */ |
| 104 | public function setInternalNotes(Description $internalNotes) |
| 105 | { |
| 106 | $this->internalNotes = $internalNotes; |
| 107 | } |
| 108 | |
| 109 | /** |
| 110 | * @return BookingStatus |
| 111 | */ |
| 112 | public function getStatus() |
| 113 | { |
| 114 | return $this->status; |
| 115 | } |
| 116 | |
| 117 | /** |
| 118 | * @param BookingStatus $status |
| 119 | */ |
| 120 | public function setStatus(BookingStatus $status) |
| 121 | { |
| 122 | $this->status = $status; |
| 123 | } |
| 124 | |
| 125 | /** |
| 126 | * @return array |
| 127 | */ |
| 128 | public function toArray() |
| 129 | { |
| 130 | return [ |
| 131 | 'id' => null !== $this->getId() ? $this->getId()->getValue() : null, |
| 132 | 'bookings' => null !== $this->getBookings() ? $this->getBookings()->toArray() : null, |
| 133 | 'notifyParticipants' => $this->isNotifyParticipants(), |
| 134 | 'internalNotes' => null !== $this->getInternalNotes() ? $this->getInternalNotes()->getValue() : null, |
| 135 | 'status' => $this->getStatus() ? $this->getStatus()->getValue() : null, |
| 136 | ]; |
| 137 | } |
| 138 | } |
| 139 |