1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
evententity.php
См. документацию.
1<?php
2
4
14
15if (!Loader::includeModule('socialnetwork'))
16{
17 return;
18}
19
20final class EventEntity extends CollabEntity
21{
22 protected ?Event $internalObject = null;
23
24 public function __construct(int $id, mixed $internalObject = null)
25 {
26 if ($internalObject instanceof Event)
27 {
28 $this->internalObject = $internalObject;
29 }
30
31 parent::__construct($id, $internalObject);
32 }
33
34 public function getType(): EntityType
35 {
36 return EntityType::CalendarEvent;
37 }
38
39 public function getData(): array
40 {
41 return $this->internalObject->toArray();
42 }
43
50 protected function fillCollab(): ?Collab
51 {
52 if ($this->internalObject->getSpecialLabel() !== Dictionary::EVENT_TYPE['collab'])
53 {
54 return null;
55 }
56
57 if (
58 $this->internalObject->isBaseEvent()
59 && $this->internalObject->getCalendarType() !== Dictionary::CALENDAR_TYPE['group']
60 )
61 {
62 return null;
63 }
64
65 if ($this->internalObject->isBaseEvent())
66 {
67 $collabId = $this->internalObject->getOwner()->getId();
68 }
69 else
70 {
71 $parentEvent = EventTable::query()
72 ->setSelect(['CAL_TYPE', 'OWNER_ID'])
73 ->where('ID', $this->internalObject->getParentId())
74 ->fetchObject()
75 ;
76
77 if ($parentEvent->getCalType() !== Dictionary::CALENDAR_TYPE['group'])
78 {
79 return null;
80 }
81
82 $collabId = $parentEvent->getOwnerId();
83 }
84
85 return $this->collabRegistry->get($collabId);
86 }
87
94 protected function checkInternalEntity(): bool
95 {
96 if ($this->internalObject !== null)
97 {
98 return true;
99 }
100
102 $mapperFactory = ServiceLocator::getInstance()->get('calendar.service.mappers.factory');
103 $internalObject = $mapperFactory->getEvent()->getById($this->id);
104
105 if (!$internalObject)
106 {
107 return false;
108 }
109
110 $this->internalObject = $internalObject;
111
112 return true;
113 }
114}
__construct(int $id, mixed $internalObject=null)
Определения evententity.php:24
Определения loader.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804