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