1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
commententity.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
13use Throwable;
14
15if (!Loader::includeModule('socialnetwork'))
16{
17 return;
18}
19
21{
22 protected ?Message $internalObject = null;
23
24 public function __construct(int $id, mixed $internalObject = null)
25 {
26 if ($internalObject instanceof Message)
27 {
28 $this->internalObject = $internalObject;
29 }
30
31 parent::__construct($id, $internalObject);
32 }
33
34 public function getType(): EntityType
35 {
36 return EntityType::Comment;
37 }
38
39 public function getData(): array
40 {
41 return (array)$this->internalObject->getData();
42 }
43
44 protected function fillCollab(): ?Collab
45 {
46 $xmlId = $this->internalObject->getXmlId();
47
48 [$entityType, $entityId] = explode('_', $xmlId);
49
50 $entityId = (int)$entityId;
51
52 if ($entityId <= 0)
53 {
54 return null;
55 }
56
57 $linkedEntity = $this->getLinkedCollabEntity($entityType, $entityId);
58
59 return $linkedEntity?->getCollab();
60 }
61
62 protected function getLinkedCollabEntity(string $entityType, int $entityId): ?CollabEntity
63 {
64 $type = match ($entityType)
65 {
66 'EVENT' => EntityType::CalendarEvent,
67 'TASK' => EntityType::Task,
68 default => null,
69 };
70
71 if ($type === null)
72 {
73 return null;
74 }
75
77 }
78
79 protected function checkInternalEntity(): bool
80 {
81 if ($this->internalObject !== null)
82 {
83 return true;
84 }
85
86 try
87 {
88 $message = new Message($this->id);
89 }
90 catch (Throwable)
91 {
92 return false;
93 }
94
95 $this->internalObject = $message;
96
97 return true;
98 }
99}
$type
Определения options.php:106
getLinkedCollabEntity(string $entityType, int $entityId)
Определения commententity.php:62
__construct(int $id, mixed $internalObject=null)
Определения commententity.php:24
Определения loader.php:13
static includeModule($moduleName)
Определения loader.php:67
static getById(int $id, EntityType|string $type)
Определения CollabEntityFactory.php:20
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$entityId
Определения payment.php:4
$message
Определения payment.php:8