PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / trunk
Booking for Appointments and Events Calendar – Amelia vtrunk
2.4.3 2.4.2 2.4.1 2.4 trunk 1.2.1 1.2.10 1.2.11 1.2.12 1.2.13 1.2.14 1.2.15 1.2.16 1.2.17 1.2.18 1.2.19 1.2.2 1.2.20 1.2.21 1.2.22 1.2.23 1.2.24 1.2.25 1.2.26 1.2.27 1.2.28 1.2.29 1.2.3 1.2.30 1.2.31 1.2.32 1.2.33 1.2.34 1.2.35 1.2.36 1.2.37 1.2.38 1.2.4 1.2.5 1.2.6 1.2.7 1.2.8 1.2.9 2.0 2.0.1 2.0.2 2.1 2.1.1 2.1.2 2.1.3 2.2 2.2.1 2.3
ameliabooking / src / Domain / Entity / Bookable / AbstractBookable.php
ameliabooking / src / Domain / Entity / Bookable Last commit date
Service 6 months ago AbstractBookable.php 2 months ago AbstractCategory.php 6 months ago AbstractExtra.php 1 year ago
AbstractBookable.php
327 lines
1 <?php
2
3 /**
4 * @copyright © Melograno Ventures. All rights reserved.
5 * @licence See COPYING.md for license details.
6 */
7
8 namespace AmeliaBooking\Domain\Entity\Bookable;
9
10 use AmeliaBooking\Domain\Collection\Collection;
11 use AmeliaBooking\Domain\ValueObjects\BooleanValueObject;
12 use AmeliaBooking\Domain\ValueObjects\Json;
13 use AmeliaBooking\Domain\ValueObjects\Number\Float\Price;
14 use AmeliaBooking\Domain\ValueObjects\Number\Integer\Id;
15 use AmeliaBooking\Domain\ValueObjects\Number\Integer\PositiveInteger;
16 use AmeliaBooking\Domain\ValueObjects\Picture;
17 use AmeliaBooking\Domain\ValueObjects\String\BookableType;
18 use AmeliaBooking\Domain\ValueObjects\String\Color;
19 use AmeliaBooking\Domain\ValueObjects\String\DepositType;
20 use AmeliaBooking\Domain\ValueObjects\String\Description;
21 use AmeliaBooking\Domain\ValueObjects\String\Name;
22
23 /**
24 * Class AbstractBookable
25 *
26 * @package AmeliaBooking\Domain\Entity\Bookable
27 */
28 abstract class AbstractBookable
29 {
30 /** @var Id | null */
31 private $id;
32
33 /** @var Name */
34 protected $name;
35
36 /** @var Description */
37 protected $description;
38
39 /** @var Color */
40 protected $color;
41
42 /** @var DepositType */
43 private $depositPayment;
44
45 /** @var Price */
46 protected $deposit;
47
48 /** @var BooleanValueObject */
49 protected $depositPerPerson;
50
51 /** @var Price */
52 protected $price;
53
54 /** @var Picture */
55 protected $picture;
56
57 /** @var PositiveInteger */
58 protected $position;
59
60 /** @var Collection */
61 private $extras;
62
63 /** @var Collection */
64 private $coupons;
65
66 /** @var Json */
67 private $settings;
68
69 /** @var BooleanValueObject */
70 protected $fullPayment;
71
72
73 /**
74 * @return Id | null
75 */
76 public function getId()
77 {
78 return $this->id;
79 }
80
81 /**
82 * @param Id | null $id
83 */
84 public function setId($id)
85 {
86 $this->id = $id;
87 }
88
89 /**
90 * @return Name
91 */
92 public function getName()
93 {
94 return $this->name;
95 }
96
97 /**
98 * @param Name $name
99 */
100 public function setName(Name $name)
101 {
102 $this->name = $name;
103 }
104
105 /**
106 * @return Description
107 */
108 public function getDescription()
109 {
110 return $this->description;
111 }
112
113 /**
114 * @param Description $description
115 */
116 public function setDescription(Description $description)
117 {
118 $this->description = $description;
119 }
120
121 /**
122 * @return Color
123 */
124 public function getColor()
125 {
126 return $this->color;
127 }
128
129 /**
130 * @param Color $color
131 */
132 public function setColor(Color $color)
133 {
134 $this->color = $color;
135 }
136
137 /**
138 * @return Price
139 */
140 public function getPrice()
141 {
142 return $this->price;
143 }
144
145 /**
146 * @param Price $price
147 */
148 public function setPrice(Price $price)
149 {
150 $this->price = $price;
151 }
152
153 /**
154 * @return Price
155 */
156 public function getDeposit()
157 {
158 return $this->deposit;
159 }
160
161 /**
162 * @param Price $deposit
163 */
164 public function setDeposit(Price $deposit)
165 {
166 $this->deposit = $deposit;
167 }
168
169 /**
170 * @return DepositType
171 */
172 public function getDepositPayment()
173 {
174 return $this->depositPayment;
175 }
176
177 /**
178 * @param DepositType $depositPayment
179 */
180 public function setDepositPayment(DepositType $depositPayment)
181 {
182 $this->depositPayment = $depositPayment;
183 }
184
185 /**
186 * @return BooleanValueObject
187 */
188 public function getDepositPerPerson()
189 {
190 return $this->depositPerPerson;
191 }
192
193 /**
194 * @param BooleanValueObject $depositPerPerson
195 */
196 public function setDepositPerPerson(BooleanValueObject $depositPerPerson)
197 {
198 $this->depositPerPerson = $depositPerPerson;
199 }
200
201 /**
202 * @return Picture
203 */
204 public function getPicture()
205 {
206 return $this->picture;
207 }
208
209 /**
210 * @param Picture $picture
211 */
212 public function setPicture(Picture $picture)
213 {
214 $this->picture = $picture;
215 }
216
217 /**
218 * @return PositiveInteger
219 */
220 public function getPosition()
221 {
222 return $this->position;
223 }
224
225 /**
226 * @param PositiveInteger $position
227 */
228 public function setPosition($position)
229 {
230 $this->position = $position;
231 }
232
233 /**
234 * @return Collection
235 */
236 public function getExtras()
237 {
238 return $this->extras;
239 }
240
241 /**
242 * @param Collection $extras
243 */
244 public function setExtras(Collection $extras)
245 {
246 $this->extras = $extras;
247 }
248
249 /**
250 * @return Collection
251 */
252 public function getCoupons()
253 {
254 return $this->coupons;
255 }
256
257 /**
258 * @param Collection $coupons
259 */
260 public function setCoupons(Collection $coupons)
261 {
262 $this->coupons = $coupons;
263 }
264
265 /**
266 * @return Json
267 */
268 public function getSettings()
269 {
270 return $this->settings;
271 }
272
273 /**
274 * @param Json | null $settings
275 */
276 public function setSettings($settings)
277 {
278 $this->settings = $settings;
279 }
280
281 /**
282 * @return BooleanValueObject
283 */
284 public function getFullPayment()
285 {
286 return $this->fullPayment;
287 }
288
289 /**
290 * @param BooleanValueObject $fullPayment
291 */
292 public function setFullPayment(BooleanValueObject $fullPayment)
293 {
294 $this->fullPayment = $fullPayment;
295 }
296
297 /**
298 * @return BookableType
299 */
300 abstract public function getType();
301
302 /**
303 * @return array
304 */
305 public function toArray()
306 {
307 return [
308 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
309 'name' => null !== $this->getName() ? $this->getName()->getValue() : null,
310 'description' => null !== $this->getDescription() ? $this->getDescription()->getValue() : null,
311 'color' => null !== $this->getColor() ? $this->getColor()->getValue() : null,
312 'price' => $this->getPrice() ? $this->getPrice()->getValue() : null,
313 'deposit' => null !== $this->getDeposit() ? $this->getDeposit()->getValue() : null,
314 'depositPayment' => null !== $this->getDepositPayment() ? $this->getDepositPayment()->getValue() : null,
315 'depositPerPerson' => null !== $this->getDepositPerPerson() ?
316 $this->getDepositPerPerson()->getValue() : null,
317 'pictureFullPath' => null !== $this->getPicture() ? $this->getPicture()->getFullPath() : null,
318 'pictureThumbPath' => null !== $this->getPicture() ? $this->getPicture()->getThumbPath() : null,
319 'extras' => $this->getExtras() ? $this->getExtras()->toArray() : [],
320 'coupons' => $this->getCoupons() ? $this->getCoupons()->toArray() : [],
321 'position' => null !== $this->getPosition() ? $this->getPosition()->getValue() : null,
322 'settings' => null !== $this->getSettings() ? $this->getSettings()->getValue() : null,
323 'fullPayment' => null !== $this->getFullPayment() ? $this->getFullPayment()->getValue() : null,
324 ];
325 }
326 }
327