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 / CustomField / CustomField.php
ameliabooking / src / Domain / Entity / CustomField Last commit date
CustomField.php 6 months ago CustomFieldOption.php 6 months ago
CustomField.php
382 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\CustomField;
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\Integer\Id;
14 use AmeliaBooking\Domain\ValueObjects\Number\Integer\IntegerValue;
15 use AmeliaBooking\Domain\ValueObjects\String\CustomFieldType;
16 use AmeliaBooking\Domain\ValueObjects\String\CustomFieldSaveType;
17 use AmeliaBooking\Domain\ValueObjects\String\Label;
18
19 /**
20 * Class CustomField
21 *
22 * @package AmeliaBooking\Domain\Entity\CustomField
23 */
24 class CustomField
25 {
26 /** @var Id */
27 private $id;
28
29 /** @var Label */
30 private $label;
31
32 /** @var CustomFieldType */
33 private $type;
34
35 /** @var CustomFieldSaveType */
36 private $saveType;
37
38 /** @var BooleanValueObject */
39 private $required;
40
41 /** @var IntegerValue */
42 private $position;
43
44 /** @var Json */
45 private $translations;
46
47 /** @var Collection */
48 private $options;
49
50 /** @var Collection */
51 private $services;
52
53 /** @var Collection */
54 private $events;
55
56 /** @var BooleanValueObject */
57 private $allServices;
58
59 /** @var BooleanValueObject */
60 private $allEvents;
61
62 /** @var BooleanValueObject */
63 private $useAsLocation;
64
65 /** @var BooleanValueObject */
66 private $saveFirstChoice;
67
68 /** @var IntegerValue */
69 private $width;
70
71 /** @var BooleanValueObject */
72 private $includeInInvoice;
73
74 /**
75 * CustomField constructor.
76 *
77 * @param Label $label
78 * @param CustomFieldType $type
79 * @param BooleanValueObject $required
80 * @param IntegerValue $position
81 * @param IntegerValue $width
82 * @param CustomFieldSaveType $saveType
83 */
84 public function __construct(
85 Label $label,
86 CustomFieldType $type,
87 BooleanValueObject $required,
88 IntegerValue $position,
89 IntegerValue $width,
90 CustomFieldSaveType $saveType
91 ) {
92 $this->label = $label;
93 $this->type = $type;
94 $this->required = $required;
95 $this->position = $position;
96 $this->width = $width;
97 $this->saveType = $saveType;
98 }
99
100 /**
101 * @return Id
102 */
103 public function getId()
104 {
105 return $this->id;
106 }
107
108 /**
109 * @param Id $id
110 */
111 public function setId($id)
112 {
113 $this->id = $id;
114 }
115
116 /**
117 * @return Label
118 */
119 public function getLabel()
120 {
121 return $this->label;
122 }
123
124 /**
125 * @param Label $label
126 */
127 public function setLabel($label)
128 {
129 $this->label = $label;
130 }
131
132 /**
133 * @return CustomFieldType
134 */
135 public function getType()
136 {
137 return $this->type;
138 }
139
140 /**
141 * @param CustomFieldType $type
142 */
143 public function setType($type)
144 {
145 $this->type = $type;
146 }
147
148 /**
149 * @return CustomFieldSaveType
150 */
151 public function getSaveType()
152 {
153 return $this->saveType;
154 }
155
156 /**
157 * @param CustomFieldSaveType $saveType
158 */
159 public function setSaveType($saveType)
160 {
161 $this->saveType = $saveType;
162 }
163
164 /**
165 * @return BooleanValueObject
166 */
167 public function getRequired()
168 {
169 return $this->required;
170 }
171
172 /**
173 * @param BooleanValueObject $required
174 */
175 public function setRequired($required)
176 {
177 $this->required = $required;
178 }
179
180 /**
181 * @return IntegerValue
182 */
183 public function getPosition()
184 {
185 return $this->position;
186 }
187
188 /**
189 * @param IntegerValue $position
190 */
191 public function setPosition($position)
192 {
193 $this->position = $position;
194 }
195
196 /**
197 * @return Json
198 */
199 public function getTranslations()
200 {
201 return $this->translations;
202 }
203
204 /**
205 * @param Json $translations
206 */
207 public function setTranslations(Json $translations)
208 {
209 $this->translations = $translations;
210 }
211
212 /**
213 * @return Collection
214 */
215 public function getOptions()
216 {
217 return $this->options;
218 }
219
220 /**
221 * @param Collection $options
222 */
223 public function setOptions($options)
224 {
225 $this->options = $options;
226 }
227
228 /**
229 * @return Collection
230 */
231 public function getServices()
232 {
233 return $this->services;
234 }
235
236 /**
237 * @param Collection $services
238 */
239 public function setServices($services)
240 {
241 $this->services = $services;
242 }
243
244 /**
245 * @return Collection
246 */
247 public function getEvents()
248 {
249 return $this->events;
250 }
251
252 /**
253 * @param Collection $events
254 */
255 public function setEvents($events)
256 {
257 $this->events = $events;
258 }
259
260 /**
261 * @return BooleanValueObject
262 */
263 public function getAllServices()
264 {
265 return $this->allServices;
266 }
267
268 /**
269 * @param BooleanValueObject $allServices
270 */
271 public function setAllServices($allServices)
272 {
273 $this->allServices = $allServices;
274 }
275
276 /**
277 * @return BooleanValueObject
278 */
279 public function getAllEvents()
280 {
281 return $this->allEvents;
282 }
283
284 /**
285 * @param BooleanValueObject $allEvents
286 */
287 public function setAllEvents($allEvents)
288 {
289 $this->allEvents = $allEvents;
290 }
291
292 /**
293 * @return BooleanValueObject
294 */
295 public function getUseAsLocation()
296 {
297 return $this->useAsLocation;
298 }
299
300 /**
301 * @param BooleanValueObject $useAsLocation
302 */
303 public function setUseAsLocation($useAsLocation)
304 {
305 $this->useAsLocation = $useAsLocation;
306 }
307
308 /**
309 * @return BooleanValueObject
310 */
311 public function getSaveFirstChoice()
312 {
313 return $this->saveFirstChoice;
314 }
315
316 /**
317 * @param BooleanValueObject $saveFirstChoice
318 */
319 public function setSaveFirstChoice($saveFirstChoice)
320 {
321 $this->saveFirstChoice = $saveFirstChoice;
322 }
323
324 /**
325 * @return IntegerValue
326 */
327 public function getWidth()
328 {
329 return $this->width;
330 }
331
332 /**
333 * @param IntegerValue $width
334 */
335 public function setWidth($width)
336 {
337 $this->position = $width;
338 }
339
340 /**
341 * @return BooleanValueObject
342 */
343 public function getIncludeInInvoice()
344 {
345 return $this->includeInInvoice;
346 }
347
348 /**
349 * @param BooleanValueObject $includeInInvoice
350 */
351 public function setIncludeInInvoice($includeInInvoice)
352 {
353 $this->includeInInvoice = $includeInInvoice;
354 }
355
356
357 /**
358 * @return array
359 */
360 public function toArray()
361 {
362 return [
363 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
364 'label' => $this->getLabel()->getValue(),
365 'type' => $this->getType()->getValue(),
366 'required' => $this->getRequired()->getValue(),
367 'position' => $this->getPosition()->getValue(),
368 'options' => $this->getOptions() ? $this->getOptions()->toArray() : [],
369 'services' => $this->getServices() ? $this->getServices()->toArray() : [],
370 'events' => $this->getEvents() ? $this->getEvents()->toArray() : [],
371 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
372 'allServices' => $this->getAllServices() ? $this->getAllServices()->getValue() : null,
373 'allEvents' => $this->getAllEvents() ? $this->getAllEvents()->getValue() : null,
374 'useAsLocation' => $this->getUseAsLocation() ? $this->getUseAsLocation()->getValue() : null,
375 'width' => $this->getWidth() ? $this->getWidth()->getValue() : 50,
376 'saveType' => $this->getSaveType()->getValue(),
377 'saveFirstChoice' => $this->getSaveFirstChoice() ? $this->getSaveFirstChoice()->getValue() : null,
378 'includeInInvoice' => $this->getIncludeInInvoice() ? $this->getIncludeInInvoice()->getValue() : null,
379 ];
380 }
381 }
382