PluginProbe ʕ •ᴥ•ʔ
Booking for Appointments and Events Calendar – Amelia / 1.2.32
Booking for Appointments and Events Calendar – Amelia v1.2.32
2.4.9 2.4.8 2.4.7 2.4.6 2.4.5 2.4.4 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 1 year ago CustomFieldOption.php 1 year ago
CustomField.php
362 lines
1 <?php
2
3 /**
4 * @copyright © TMS-Plugins. 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 /**
72 * CustomField constructor.
73 *
74 * @param Label $label
75 * @param CustomFieldType $type
76 * @param BooleanValueObject $required
77 * @param IntegerValue $position
78 * @param IntegerValue $width
79 * @param CustomFieldSaveType $saveType
80 */
81 public function __construct(
82 Label $label,
83 CustomFieldType $type,
84 BooleanValueObject $required,
85 IntegerValue $position,
86 IntegerValue $width,
87 CustomFieldSaveType $saveType
88 ) {
89 $this->label = $label;
90 $this->type = $type;
91 $this->required = $required;
92 $this->position = $position;
93 $this->width = $width;
94 $this->saveType = $saveType;
95 }
96
97 /**
98 * @return Id
99 */
100 public function getId()
101 {
102 return $this->id;
103 }
104
105 /**
106 * @param Id $id
107 */
108 public function setId($id)
109 {
110 $this->id = $id;
111 }
112
113 /**
114 * @return Label
115 */
116 public function getLabel()
117 {
118 return $this->label;
119 }
120
121 /**
122 * @param Label $label
123 */
124 public function setLabel($label)
125 {
126 $this->label = $label;
127 }
128
129 /**
130 * @return CustomFieldType
131 */
132 public function getType()
133 {
134 return $this->type;
135 }
136
137 /**
138 * @param CustomFieldType $type
139 */
140 public function setType($type)
141 {
142 $this->type = $type;
143 }
144
145 /**
146 * @return CustomFieldSaveType
147 */
148 public function getSaveType()
149 {
150 return $this->saveType;
151 }
152
153 /**
154 * @param CustomFieldSaveType $saveType
155 */
156 public function setSaveType($saveType)
157 {
158 $this->saveType = $saveType;
159 }
160
161 /**
162 * @return BooleanValueObject
163 */
164 public function getRequired()
165 {
166 return $this->required;
167 }
168
169 /**
170 * @param BooleanValueObject $required
171 */
172 public function setRequired($required)
173 {
174 $this->required = $required;
175 }
176
177 /**
178 * @return IntegerValue
179 */
180 public function getPosition()
181 {
182 return $this->position;
183 }
184
185 /**
186 * @param IntegerValue $position
187 */
188 public function setPosition($position)
189 {
190 $this->position = $position;
191 }
192
193 /**
194 * @return Json
195 */
196 public function getTranslations()
197 {
198 return $this->translations;
199 }
200
201 /**
202 * @param Json $translations
203 */
204 public function setTranslations(Json $translations)
205 {
206 $this->translations = $translations;
207 }
208
209 /**
210 * @return Collection
211 */
212 public function getOptions()
213 {
214 return $this->options;
215 }
216
217 /**
218 * @param Collection $options
219 */
220 public function setOptions($options)
221 {
222 $this->options = $options;
223 }
224
225 /**
226 * @return Collection
227 */
228 public function getServices()
229 {
230 return $this->services;
231 }
232
233 /**
234 * @param Collection $services
235 */
236 public function setServices($services)
237 {
238 $this->services = $services;
239 }
240
241 /**
242 * @return Collection
243 */
244 public function getEvents()
245 {
246 return $this->events;
247 }
248
249 /**
250 * @param Collection $events
251 */
252 public function setEvents($events)
253 {
254 $this->events = $events;
255 }
256
257 /**
258 * @return BooleanValueObject
259 */
260 public function getAllServices()
261 {
262 return $this->allServices;
263 }
264
265 /**
266 * @param BooleanValueObject $allServices
267 */
268 public function setAllServices($allServices)
269 {
270 $this->allServices = $allServices;
271 }
272
273 /**
274 * @return BooleanValueObject
275 */
276 public function getAllEvents()
277 {
278 return $this->allEvents;
279 }
280
281 /**
282 * @param BooleanValueObject $allEvents
283 */
284 public function setAllEvents($allEvents)
285 {
286 $this->allEvents = $allEvents;
287 }
288
289 /**
290 * @return BooleanValueObject
291 */
292 public function getUseAsLocation()
293 {
294 return $this->useAsLocation;
295 }
296
297 /**
298 * @param BooleanValueObject $useAsLocation
299 */
300 public function setUseAsLocation($useAsLocation)
301 {
302 $this->useAsLocation = $useAsLocation;
303 }
304
305 /**
306 * @return BooleanValueObject
307 */
308 public function getSaveFirstChoice()
309 {
310 return $this->saveFirstChoice;
311 }
312
313 /**
314 * @param BooleanValueObject $saveFirstChoice
315 */
316 public function setSaveFirstChoice($saveFirstChoice)
317 {
318 $this->saveFirstChoice = $saveFirstChoice;
319 }
320
321 /**
322 * @return IntegerValue
323 */
324 public function getWidth()
325 {
326 return $this->width;
327 }
328
329 /**
330 * @param IntegerValue $width
331 */
332 public function setWidth($width)
333 {
334 $this->position = $width;
335 }
336
337
338 /**
339 * @return array
340 */
341 public function toArray()
342 {
343 return [
344 'id' => null !== $this->getId() ? $this->getId()->getValue() : null,
345 'label' => $this->getLabel()->getValue(),
346 'type' => $this->getType()->getValue(),
347 'required' => $this->getRequired()->getValue(),
348 'position' => $this->getPosition()->getValue(),
349 'options' => $this->getOptions() ? $this->getOptions()->toArray() : [],
350 'services' => $this->getServices() ? $this->getServices()->toArray() : [],
351 'events' => $this->getEvents() ? $this->getEvents()->toArray() : [],
352 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null,
353 'allServices' => $this->getAllServices() ? $this->getAllServices()->getValue() : null,
354 'allEvents' => $this->getAllEvents() ? $this->getAllEvents()->getValue() : null,
355 'useAsLocation' => $this->getUseAsLocation() ? $this->getUseAsLocation()->getValue() : null,
356 'width' => $this->getWidth() ? $this->getWidth()->getValue() : 50,
357 'saveType' => $this->getSaveType()->getValue(),
358 'saveFirstChoice' => $this->getSaveFirstChoice() ? $this->getSaveFirstChoice()->getValue() : null,
359 ];
360 }
361 }
362