Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
BaseLinkCollection.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Link
;
4
5
use
Bitrix\Im\V2\Collection
;
6
use
Bitrix\Im\V2\Entity
;
7
use
Bitrix\Im\V2\Link
;
8
use
Bitrix\Im\V2\Message
;
9
use
Bitrix\Im\V2\Rest\PopupData
;
10
15
abstract
class
BaseLinkCollection
extends
Collection
implements
LinkRestConvertible
16
{
20
abstract
public
static
function
getCollectionElementClass
(): string;
21
22
public
function
getPopupData
(array $excludedList = []):
PopupData
23
{
24
$data =
new
PopupData
([
new
Entity
\
User
\
UserPopupItem
()], $excludedList);
25
26
foreach
($this as $link)
27
{
28
$data->mergeFromEntity($link, $excludedList);
29
}
30
31
return
$data;
32
}
33
34
public
static
function
getRestEntityName
(): string
35
{
36
return
'list'
;
37
}
38
39
public
function
toRestFormatIdOnly
(): array
40
{
41
$ids = [];
42
43
foreach
($this as $item)
44
{
45
$ids[] = $item->toRestFormatIdOnly();
46
}
47
48
return
$ids;
49
}
50
51
public
function
setMessageInfo
(
Message
$message):
Link
52
{
53
foreach
($this as $link)
54
{
55
$link->
setMessageInfo
($message);
56
}
57
58
return
$this;
59
}
60
61
public
function
getEntityIds
(): array
62
{
63
$ids = [];
64
65
foreach
($this as $link)
66
{
67
$ids[] = $link->getEntityId();
68
}
69
70
return
$ids;
71
}
72
79
public
static
function
linkEntityToMessage(
Entity
\
EntityCollection
$entities,
Message
$message): self
80
{
81
$linkCollection =
new
static
();
82
83
foreach
($entities as $entity)
84
{
85
$linkItemClass = static::getCollectionElementClass();
87
$linkItem =
new
$linkItemClass;
88
$linkItem->setEntity($entity)->setMessageInfo($message);
89
$linkCollection->add($linkItem);
90
}
91
92
return
$linkCollection;
93
}
94
95
public
function
toRestFormat
(array $option = []): array
96
{
97
$linkCollection = [];
98
99
foreach
($this as $link)
100
{
101
$linkCollection[] = $link->toRestFormat($option);
102
}
103
104
return
$linkCollection;
105
}
106
}
Bitrix\Im\User
Definition
user.php:10
Bitrix\Im\V2\Collection
Definition
Collection.php:14
Bitrix\Im\V2\Entity\EntityCollection
Definition
EntityCollection.php:13
Bitrix\Im\V2\Entity\User\UserPopupItem
Definition
UserPopupItem.php:8
Bitrix\Im\V2\Link\BaseLinkCollection
Definition
BaseLinkCollection.php:16
Bitrix\Im\V2\Link\BaseLinkCollection\getRestEntityName
static getRestEntityName()
Definition
BaseLinkCollection.php:34
Bitrix\Im\V2\Link\BaseLinkCollection\toRestFormat
toRestFormat(array $option=[])
Definition
BaseLinkCollection.php:95
Bitrix\Im\V2\Link\BaseLinkCollection\setMessageInfo
setMessageInfo(Message $message)
Definition
BaseLinkCollection.php:51
Bitrix\Im\V2\Link\BaseLinkCollection\getCollectionElementClass
static getCollectionElementClass()
Bitrix\Im\V2\Link\BaseLinkCollection\getPopupData
getPopupData(array $excludedList=[])
Definition
BaseLinkCollection.php:22
Bitrix\Im\V2\Link\BaseLinkCollection\getEntityIds
getEntityIds()
Definition
BaseLinkCollection.php:61
Bitrix\Im\V2\Link\BaseLinkCollection\toRestFormatIdOnly
toRestFormatIdOnly()
Definition
BaseLinkCollection.php:39
Bitrix\Im\V2\Message
Definition
Message.php:44
Bitrix\Im\V2\Rest\PopupData
Definition
PopupData.php:6
Bitrix\Im\V2\Entity
Definition
Entity.php:6
Bitrix\Im\V2\Link\LinkRestConvertible
Definition
LinkRestConvertible.php:10
Bitrix\Im\V2\Link
Definition
Link.php:6
Bitrix\Im\V2\Link\setMessageInfo
setMessageInfo(Message $message)
Bitrix\Im\V2\Entity
Bitrix\Im\V2\Link
Definition
BaseLinkCollection.php:3
Bitrix\Im\V2\Message
Definition
AdditionalMessagePopupItem.php:3
modules
im
lib
V2
Link
BaseLinkCollection.php
Создано системой
1.10.0