1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
eventoptionbuilderfromarray.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Core\Builders\EventOption;
4
5use Bitrix\Calendar\Core\Builders\BuilderException;
6use Bitrix\Calendar\Core\EventCategory\EventCategory;
7use Bitrix\Calendar\Core\EventOption\OptionsDto;
8use Bitrix\Calendar\Core\Mappers\Factory;
9use Bitrix\Main\DI\ServiceLocator;
10
12{
13 public function __construct(private readonly array $eventOption)
14 {
15 }
16
17 protected function getId(): ?int
18 {
19 return $this->eventOption['ID'] ?? null;
20 }
21
22 protected function getEventId(): ?int
23 {
24 return $this->eventOption['EVENT_ID'] ?? null;
25 }
26
27 protected function getCategoryId(): ?int
28 {
29 return $this->eventOption['CATEGORY_ID'] ?? null;
30 }
31
32 protected function getCategory(): EventCategory
33 {
34 if ($this->getCategoryId() !== null)
35 {
37 $mapperFactory = ServiceLocator::getInstance()->get('calendar.service.mappers.factory');
38 $eventCategoryFactory = $mapperFactory->getEventCategory();
39
40 return $eventCategoryFactory->getById($this->getCategoryId());
41 }
42
43 throw new BuilderException('it is impossible to find the event category');
44 }
45
46 protected function getThreadId(): ?int
47 {
48 return $this->eventOption['THREAD_ID'] ?? null;
49 }
50
51 protected function getOptions(): ?OptionsDto
52 {
53 return $this->eventOption['OPTIONS']
54 ? OptionsDto::fromArray($this->eventOption['OPTIONS'])
55 : null;
56 }
57
58 protected function getAttendeesCount(): int
59 {
60 return $this->eventOption['ATTENDEES_COUNT'] ?? 0;
61 }
62}
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804