1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
commententity.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity
;
6
7
use
Bitrix\Forum\Message
;
8
use
Bitrix\Main\Loader
;
9
use
Bitrix\Socialnetwork\Collab\Collab
;
10
use
Bitrix\Socialnetwork\Collab\Entity\CollabEntity
;
11
use
Bitrix\Socialnetwork\Collab\Entity\CollabEntityFactory
;
12
use
Bitrix\Socialnetwork\Collab\Entity\Type\EntityType
;
13
use Throwable;
14
15
if
(!
Loader::includeModule
(
'socialnetwork'
))
16
{
17
return
;
18
}
19
20
class
CommentEntity
extends
CollabEntity
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
76
return
CollabEntityFactory::getById
(
$entityId
,
$type
);
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
$type
Определения
options.php:106
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity
Определения
commententity.php:21
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\fillCollab
fillCollab()
Определения
commententity.php:44
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\getData
getData()
Определения
commententity.php:39
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\getType
getType()
Определения
commententity.php:34
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\getLinkedCollabEntity
getLinkedCollabEntity(string $entityType, int $entityId)
Определения
commententity.php:62
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\checkInternalEntity
checkInternalEntity()
Определения
commententity.php:79
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\$internalObject
Message $internalObject
Определения
commententity.php:22
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity\CommentEntity\__construct
__construct(int $id, mixed $internalObject=null)
Определения
commententity.php:24
Bitrix\Forum\Message
Определения
message.php:611
Bitrix\Main\Loader
Определения
loader.php:13
Bitrix\Main\Loader\includeModule
static includeModule($moduleName)
Определения
loader.php:67
Bitrix\Socialnetwork\Collab\Collab
Определения
Collab.php:16
Bitrix\Socialnetwork\Collab\Entity\CollabEntityFactory
Определения
CollabEntityFactory.php:19
Bitrix\Socialnetwork\Collab\Entity\CollabEntityFactory\getById
static getById(int $id, EntityType|string $type)
Определения
CollabEntityFactory.php:20
Bitrix\Socialnetwork\Collab\Entity\CollabEntity
Определения
CollabEntity.php:16
Bitrix\Socialnetwork\Collab\Entity\CollabEntity\$id
int $id
Определения
CollabEntity.php:20
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
Bitrix\Forum\Integration\Socialnetwork\Collab\Entity
Определения
commententity.php:5
Bitrix\Socialnetwork\Collab\Entity\Type\EntityType
EntityType
Определения
EntityType.php:8
$entityId
$entityId
Определения
payment.php:4
$message
$message
Определения
payment.php:8
bitrix
modules
forum
lib
integration
socialnetwork
collab
entity
commententity.php
Создано системой
1.14.0