Category.php
7 years ago
Extra.php
2 years ago
Package.php
2 years ago
PackageCustomer.php
2 years ago
PackageCustomerService.php
5 years ago
PackageService.php
2 years ago
Resource.php
2 years ago
Service.php
2 years ago
Service.php
495 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\Bookable\Service; |
| 8 | |
| 9 | use AmeliaBooking\Domain\Collection\Collection; |
| 10 | use AmeliaBooking\Domain\Entity\Entities; |
| 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\Number\Integer\WholeNumber; |
| 16 | use AmeliaBooking\Domain\ValueObjects\String\BookableType; |
| 17 | use AmeliaBooking\Domain\ValueObjects\String\Cycle; |
| 18 | use AmeliaBooking\Domain\ValueObjects\String\Status; |
| 19 | use AmeliaBooking\Domain\ValueObjects\Priority; |
| 20 | use AmeliaBooking\Domain\ValueObjects\String\Name; |
| 21 | use AmeliaBooking\Domain\Entity\Bookable\AbstractBookable; |
| 22 | use AmeliaBooking\Domain\ValueObjects\Duration; |
| 23 | use AmeliaBooking\Domain\ValueObjects\PositiveDuration; |
| 24 | |
| 25 | /** |
| 26 | * Class Service |
| 27 | * |
| 28 | * @package AmeliaBooking\Domain\Entity\Bookable\Service |
| 29 | */ |
| 30 | class Service extends AbstractBookable |
| 31 | { |
| 32 | /** @var IntegerValue */ |
| 33 | private $minCapacity; |
| 34 | |
| 35 | /** @var IntegerValue */ |
| 36 | private $maxCapacity; |
| 37 | |
| 38 | /** @var PositiveDuration */ |
| 39 | private $duration; |
| 40 | |
| 41 | /** @var Duration */ |
| 42 | private $timeBefore; |
| 43 | |
| 44 | /** @var Duration */ |
| 45 | private $timeAfter; |
| 46 | |
| 47 | /** @var IntegerValue */ |
| 48 | private $minSelectedExtras; |
| 49 | |
| 50 | /** @var BooleanValueObject */ |
| 51 | private $bringingAnyone; |
| 52 | |
| 53 | /** @var BooleanValueObject */ |
| 54 | private $mandatoryExtra; |
| 55 | |
| 56 | /** @var Priority */ |
| 57 | private $priority; |
| 58 | |
| 59 | /** @var Collection */ |
| 60 | private $gallery; |
| 61 | |
| 62 | /** @var Status */ |
| 63 | protected $status; |
| 64 | |
| 65 | /** @var Id */ |
| 66 | protected $categoryId; |
| 67 | |
| 68 | /** @var Category */ |
| 69 | protected $category; |
| 70 | |
| 71 | /** @var BooleanValueObject */ |
| 72 | protected $show; |
| 73 | |
| 74 | /** @var BooleanValueObject */ |
| 75 | protected $aggregatedPrice; |
| 76 | |
| 77 | /** @var Cycle */ |
| 78 | protected $recurringCycle; |
| 79 | |
| 80 | /** @var Name */ |
| 81 | protected $recurringSub; |
| 82 | |
| 83 | /** @var WholeNumber */ |
| 84 | protected $recurringPayment; |
| 85 | |
| 86 | /** @var Json */ |
| 87 | protected $translations; |
| 88 | |
| 89 | /** @var Json */ |
| 90 | protected $customPricing; |
| 91 | |
| 92 | /** @var IntegerValue */ |
| 93 | private $maxExtraPeople; |
| 94 | |
| 95 | |
| 96 | /** @var Json */ |
| 97 | protected $limitPerCustomer; |
| 98 | |
| 99 | /** |
| 100 | * @return Id |
| 101 | */ |
| 102 | public function getCategoryId() |
| 103 | { |
| 104 | return $this->categoryId; |
| 105 | } |
| 106 | |
| 107 | /** |
| 108 | * @param Id $categoryId |
| 109 | */ |
| 110 | public function setCategoryId(Id $categoryId) |
| 111 | { |
| 112 | $this->categoryId = $categoryId; |
| 113 | } |
| 114 | |
| 115 | /** |
| 116 | * @return Category |
| 117 | */ |
| 118 | public function getCategory() |
| 119 | { |
| 120 | return $this->category; |
| 121 | } |
| 122 | |
| 123 | /** |
| 124 | * @param Category $category |
| 125 | */ |
| 126 | public function setCategory(Category $category) |
| 127 | { |
| 128 | $this->category = $category; |
| 129 | } |
| 130 | |
| 131 | /** |
| 132 | * @return Status |
| 133 | */ |
| 134 | public function getStatus() |
| 135 | { |
| 136 | return $this->status; |
| 137 | } |
| 138 | |
| 139 | /** |
| 140 | * @param Status $status |
| 141 | */ |
| 142 | public function setStatus(Status $status) |
| 143 | { |
| 144 | $this->status = $status; |
| 145 | } |
| 146 | |
| 147 | /** |
| 148 | * @return IntegerValue |
| 149 | */ |
| 150 | public function getMinCapacity() |
| 151 | { |
| 152 | return $this->minCapacity; |
| 153 | } |
| 154 | |
| 155 | /** |
| 156 | * @param IntegerValue $minCapacity |
| 157 | */ |
| 158 | public function setMinCapacity(IntegerValue $minCapacity) |
| 159 | { |
| 160 | $this->minCapacity = $minCapacity; |
| 161 | } |
| 162 | |
| 163 | /** |
| 164 | * @return IntegerValue |
| 165 | */ |
| 166 | public function getMaxCapacity() |
| 167 | { |
| 168 | return $this->maxCapacity; |
| 169 | } |
| 170 | |
| 171 | /** |
| 172 | * @param IntegerValue $maxCapacity |
| 173 | */ |
| 174 | public function setMaxCapacity(IntegerValue $maxCapacity) |
| 175 | { |
| 176 | $this->maxCapacity = $maxCapacity; |
| 177 | } |
| 178 | |
| 179 | /** |
| 180 | * @return PositiveDuration |
| 181 | */ |
| 182 | public function getDuration() |
| 183 | { |
| 184 | return $this->duration; |
| 185 | } |
| 186 | |
| 187 | /** |
| 188 | * @param PositiveDuration $duration |
| 189 | */ |
| 190 | public function setDuration(PositiveDuration $duration) |
| 191 | { |
| 192 | $this->duration = $duration; |
| 193 | } |
| 194 | |
| 195 | /** |
| 196 | * @return Duration |
| 197 | */ |
| 198 | public function getTimeBefore() |
| 199 | { |
| 200 | return $this->timeBefore; |
| 201 | } |
| 202 | |
| 203 | /** |
| 204 | * @param Duration $timeBefore |
| 205 | */ |
| 206 | public function setTimeBefore(Duration $timeBefore) |
| 207 | { |
| 208 | $this->timeBefore = $timeBefore; |
| 209 | } |
| 210 | |
| 211 | /** |
| 212 | * @return IntegerValue |
| 213 | */ |
| 214 | public function getMinSelectedExtras() |
| 215 | { |
| 216 | return $this->minSelectedExtras; |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * @param IntegerValue $minSelectedExtras |
| 221 | */ |
| 222 | public function setMinSelectedExtras(IntegerValue $minSelectedExtras) |
| 223 | { |
| 224 | $this->minSelectedExtras = $minSelectedExtras; |
| 225 | } |
| 226 | |
| 227 | /** |
| 228 | * @return Duration |
| 229 | */ |
| 230 | public function getTimeAfter() |
| 231 | { |
| 232 | return $this->timeAfter; |
| 233 | } |
| 234 | |
| 235 | /** |
| 236 | * @param Duration $timeAfter |
| 237 | */ |
| 238 | public function setTimeAfter(Duration $timeAfter) |
| 239 | { |
| 240 | $this->timeAfter = $timeAfter; |
| 241 | } |
| 242 | |
| 243 | /** |
| 244 | * @return BooleanValueObject |
| 245 | */ |
| 246 | public function getBringingAnyone() |
| 247 | { |
| 248 | return $this->bringingAnyone; |
| 249 | } |
| 250 | |
| 251 | /** |
| 252 | * @param BooleanValueObject $bringingAnyone |
| 253 | */ |
| 254 | public function setBringingAnyone(BooleanValueObject $bringingAnyone) |
| 255 | { |
| 256 | $this->bringingAnyone = $bringingAnyone; |
| 257 | } |
| 258 | |
| 259 | /** |
| 260 | * @return BooleanValueObject |
| 261 | */ |
| 262 | public function getShow() |
| 263 | { |
| 264 | return $this->show; |
| 265 | } |
| 266 | |
| 267 | /** |
| 268 | * @param BooleanValueObject $show |
| 269 | */ |
| 270 | public function setShow(BooleanValueObject $show) |
| 271 | { |
| 272 | $this->show = $show; |
| 273 | } |
| 274 | |
| 275 | /** |
| 276 | * @return BooleanValueObject |
| 277 | */ |
| 278 | public function getAggregatedPrice() |
| 279 | { |
| 280 | return $this->aggregatedPrice; |
| 281 | } |
| 282 | |
| 283 | /** |
| 284 | * @param BooleanValueObject $aggregatedPrice |
| 285 | */ |
| 286 | public function setAggregatedPrice(BooleanValueObject $aggregatedPrice) |
| 287 | { |
| 288 | $this->aggregatedPrice = $aggregatedPrice; |
| 289 | } |
| 290 | |
| 291 | /** |
| 292 | * @return BooleanValueObject |
| 293 | */ |
| 294 | public function getMandatoryExtra() |
| 295 | { |
| 296 | return $this->mandatoryExtra; |
| 297 | } |
| 298 | |
| 299 | /** |
| 300 | * @param BooleanValueObject $mandatoryExtra |
| 301 | */ |
| 302 | public function setMandatoryExtra(BooleanValueObject $mandatoryExtra) |
| 303 | { |
| 304 | $this->mandatoryExtra = $mandatoryExtra; |
| 305 | } |
| 306 | |
| 307 | /** |
| 308 | * @return Priority |
| 309 | */ |
| 310 | public function getPriority() |
| 311 | { |
| 312 | return $this->priority; |
| 313 | } |
| 314 | |
| 315 | /** |
| 316 | * @param Priority $priority |
| 317 | */ |
| 318 | public function setPriority(Priority $priority) |
| 319 | { |
| 320 | $this->priority = $priority; |
| 321 | } |
| 322 | |
| 323 | /** |
| 324 | * @return Collection |
| 325 | */ |
| 326 | public function getGallery() |
| 327 | { |
| 328 | return $this->gallery; |
| 329 | } |
| 330 | |
| 331 | /** |
| 332 | * @param Collection $gallery |
| 333 | */ |
| 334 | public function setGallery(Collection $gallery) |
| 335 | { |
| 336 | $this->gallery = $gallery; |
| 337 | } |
| 338 | |
| 339 | /** |
| 340 | * @return Cycle |
| 341 | */ |
| 342 | public function getRecurringCycle() |
| 343 | { |
| 344 | return $this->recurringCycle; |
| 345 | } |
| 346 | |
| 347 | /** |
| 348 | * @param Cycle $recurringCycle |
| 349 | */ |
| 350 | public function setRecurringCycle(Cycle $recurringCycle) |
| 351 | { |
| 352 | $this->recurringCycle = $recurringCycle; |
| 353 | } |
| 354 | |
| 355 | /** |
| 356 | * @return Name |
| 357 | */ |
| 358 | public function getRecurringSub() |
| 359 | { |
| 360 | return $this->recurringSub; |
| 361 | } |
| 362 | |
| 363 | /** |
| 364 | * @param Name $recurringSub |
| 365 | */ |
| 366 | public function setRecurringSub(Name $recurringSub) |
| 367 | { |
| 368 | $this->recurringSub = $recurringSub; |
| 369 | } |
| 370 | |
| 371 | /** |
| 372 | * @return WholeNumber |
| 373 | */ |
| 374 | public function getRecurringPayment() |
| 375 | { |
| 376 | return $this->recurringPayment; |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * @param WholeNumber $recurringPayment |
| 381 | */ |
| 382 | public function setRecurringPayment(WholeNumber $recurringPayment) |
| 383 | { |
| 384 | $this->recurringPayment = $recurringPayment; |
| 385 | } |
| 386 | |
| 387 | /** |
| 388 | * @return Json |
| 389 | */ |
| 390 | public function getTranslations() |
| 391 | { |
| 392 | return $this->translations; |
| 393 | } |
| 394 | |
| 395 | /** |
| 396 | * @param Json $translations |
| 397 | */ |
| 398 | public function setTranslations(Json $translations) |
| 399 | { |
| 400 | $this->translations = $translations; |
| 401 | } |
| 402 | |
| 403 | /** |
| 404 | * @return Json |
| 405 | */ |
| 406 | public function getCustomPricing() |
| 407 | { |
| 408 | return $this->customPricing; |
| 409 | } |
| 410 | |
| 411 | /** |
| 412 | * @param Json $customPricing |
| 413 | */ |
| 414 | public function setCustomPricing(Json $customPricing) |
| 415 | { |
| 416 | $this->customPricing = $customPricing; |
| 417 | } |
| 418 | |
| 419 | /** |
| 420 | * @return IntegerValue |
| 421 | */ |
| 422 | public function getMaxExtraPeople() |
| 423 | { |
| 424 | return $this->maxExtraPeople; |
| 425 | } |
| 426 | |
| 427 | /** |
| 428 | * @param IntegerValue $maxExtraPeople |
| 429 | */ |
| 430 | public function setMaxExtraPeople($maxExtraPeople) |
| 431 | { |
| 432 | $this->maxExtraPeople = $maxExtraPeople; |
| 433 | } |
| 434 | |
| 435 | |
| 436 | /** |
| 437 | * @return Json |
| 438 | */ |
| 439 | public function getLimitPerCustomer() |
| 440 | { |
| 441 | return $this->limitPerCustomer; |
| 442 | } |
| 443 | |
| 444 | /** |
| 445 | * @param Json $limitPerCustomer |
| 446 | */ |
| 447 | public function setLimitPerCustomer($limitPerCustomer) |
| 448 | { |
| 449 | $this->limitPerCustomer = $limitPerCustomer; |
| 450 | } |
| 451 | |
| 452 | /** |
| 453 | * @return BookableType |
| 454 | */ |
| 455 | public function getType() |
| 456 | { |
| 457 | return new BookableType(Entities::SERVICE); |
| 458 | } |
| 459 | |
| 460 | |
| 461 | /** |
| 462 | * @return array |
| 463 | */ |
| 464 | public function toArray() |
| 465 | { |
| 466 | return array_merge( |
| 467 | parent::toArray(), |
| 468 | [ |
| 469 | 'minCapacity' => $this->getMinCapacity() ? $this->getMinCapacity()->getValue() : null, |
| 470 | 'maxCapacity' => $this->getMaxCapacity() ? $this->getMaxCapacity()->getValue() : null, |
| 471 | 'duration' => $this->getDuration() ? $this->getDuration()->getValue() : null, |
| 472 | 'timeBefore' => $this->getTimeBefore() ? $this->getTimeBefore()->getValue() : null, |
| 473 | 'timeAfter' => $this->getTimeAfter() ? $this->getTimeAfter()->getValue() : null, |
| 474 | 'bringingAnyone' => $this->getBringingAnyone() ? $this->getBringingAnyone()->getValue() : null, |
| 475 | 'show' => $this->getShow() ? $this->getShow()->getValue() : null, |
| 476 | 'aggregatedPrice' => $this->getAggregatedPrice() ? $this->getAggregatedPrice()->getValue() : null, |
| 477 | 'status' => $this->getStatus() ? $this->getStatus()->getValue() : null, |
| 478 | 'categoryId' => $this->getCategoryId() ? $this->getCategoryId()->getValue() : null, |
| 479 | 'category' => $this->getCategory() ? $this->getCategory()->toArray() : null, |
| 480 | 'priority' => $this->getPriority() ? $this->getPriority()->getValue() : [], |
| 481 | 'gallery' => $this->getGallery() ? $this->getGallery()->toArray() : [], |
| 482 | 'recurringCycle' => $this->getRecurringCycle() ? $this->getRecurringCycle()->getValue() : null, |
| 483 | 'recurringSub' => $this->getRecurringSub() ? $this->getRecurringSub()->getValue() : null, |
| 484 | 'recurringPayment' => $this->getRecurringPayment() ? $this->getRecurringPayment()->getValue() : null, |
| 485 | 'translations' => $this->getTranslations() ? $this->getTranslations()->getValue() : null, |
| 486 | 'minSelectedExtras'=> $this->getMinSelectedExtras() ? $this->getMinSelectedExtras()->getValue() : null, |
| 487 | 'mandatoryExtra' => $this->getMandatoryExtra() ? $this->getMandatoryExtra()->getValue() : null, |
| 488 | 'customPricing' => $this->getCustomPricing() ? $this->getCustomPricing()->getValue() : null, |
| 489 | 'maxExtraPeople' => $this->getMaxExtraPeople() ? $this->getMaxExtraPeople()->getValue() : null, |
| 490 | 'limitPerCustomer' => $this->getLimitPerCustomer() ? $this->getLimitPerCustomer()->getValue() : null, |
| 491 | ] |
| 492 | ); |
| 493 | } |
| 494 | } |
| 495 |