1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
sectionentity.php
См. документацию.
1<?php
2
3namespace Bitrix\Calendar\Integration\SocialNetwork\Collab\Entity;
4
5use Bitrix\Calendar\Core\Event\Tools\Dictionary;
6use Bitrix\Calendar\Core\Mappers;
7use Bitrix\Calendar\Core\Section\Section;
8use Bitrix\Main\DI\ServiceLocator;
9use Bitrix\Main\Loader;
10use Bitrix\Socialnetwork\Collab\Collab;
11use Bitrix\Socialnetwork\Collab\Entity\CollabEntity;
12use Bitrix\Socialnetwork\Collab\Entity\Type\EntityType;
13
14if (!Loader::includeModule('socialnetwork'))
15{
16 return;
17}
18
19final class SectionEntity extends CollabEntity
20{
21 protected ?Section $internalObject = null;
22
23 public function __construct(int $id, mixed $internalObject = null)
24 {
25 if ($internalObject instanceof Section)
26 {
27 $this->internalObject = $internalObject;
28 }
29
30 parent::__construct($id, $internalObject);
31 }
32
33 public function getType(): EntityType
34 {
35 return EntityType::CalendarSection;
36 }
37
38 public function getData(): array
39 {
40 return $this->internalObject->toArray();
41 }
42
49 protected function fillCollab(): ?Collab
50 {
51 if (
52 $this->internalObject?->getType() !== Dictionary::CALENDAR_TYPE['group']
53 || !$this->internalObject?->getOwner()?->getId()
54 )
55 {
56 return null;
57 }
58
59 return $this->collabRegistry->get($this->internalObject?->getOwner()?->getId());
60 }
61
68 protected function checkInternalEntity(): bool
69 {
70 if ($this->internalObject !== null)
71 {
72 return true;
73 }
74
76 $mapperFactory = ServiceLocator::getInstance()->get('calendar.service.mappers.factory');
77 $internalObject = $mapperFactory->getSection()->getById($this->id);
78
79 if (!$internalObject)
80 {
81 return false;
82 }
83
84 $this->internalObject = $internalObject;
85
86 return true;
87 }
88}
getById(int $id)
Определения mapper.php:28
__construct(int $id, mixed $internalObject=null)
Определения sectionentity.php:23
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804