1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
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
use
Bitrix\Im\V2\TariffLimit\DateFilterable
;
11
use
Bitrix\Im\V2\TariffLimit\FilterResult
;
12
use
Bitrix\Main\Type\DateTime
;
13
18
abstract
class
BaseLinkCollection
extends
Collection
implements
LinkRestConvertible
,
DateFilterable
19
{
23
abstract
public
static
function
getCollectionElementClass
(): string;
24
25
public
function
getPopupData
(
array
$excludedList = []):
PopupData
26
{
27
$data
=
new
PopupData
([
new
Entity
\
User
\
UserPopupItem
()], $excludedList);
28
29
foreach
($this as $link)
30
{
31
$data
->mergeFromEntity($link, $excludedList);
32
}
33
34
return
$data
;
35
}
36
37
public
function
filterByDate
(
DateTime
$date):
FilterResult
38
{
39
$filtered = $this->filter(
static
fn (
BaseLinkItem
$link) => $link->
getDateCreate
()?->getTimestamp() > $date->
getTimestamp
());
40
41
return
(
new
FilterResult
())->setResult($filtered)->setFiltered($this->
count
() !== $filtered->count());
42
}
43
44
public
function
getRelatedChatId
(): ?int
45
{
46
return
$this->getAny()?->getChatId();
47
}
48
49
public
static
function
getRestEntityName
(): string
50
{
51
return
'list'
;
52
}
53
54
public
function
toRestFormatIdOnly
():
array
55
{
56
$ids = [];
57
58
foreach
($this as $item)
59
{
60
$ids[] = $item->toRestFormatIdOnly();
61
}
62
63
return
$ids;
64
}
65
66
public
function
setMessageInfo
(
Message
$message
):
Link
67
{
68
foreach
($this as $link)
69
{
70
$link->setMessageInfo(
$message
);
71
}
72
73
return
$this;
74
}
75
76
public
function
getEntityIds
():
array
77
{
78
$ids = [];
79
80
foreach
($this as $link)
81
{
82
$ids[] = $link->getEntityId();
83
}
84
85
return
$ids;
86
}
87
94
public
static
function
linkEntityToMessage(
Entity
\
EntityCollection
$entities,
Message
$message
): self
95
{
96
$linkCollection =
new
static
();
97
98
foreach
($entities as
$entity
)
99
{
100
$linkItemClass = static::getCollectionElementClass();
102
$linkItem =
new
$linkItemClass;
103
$linkItem->setEntity(
$entity
)->setMessageInfo(
$message
);
104
$linkCollection->add($linkItem);
105
}
106
107
return
$linkCollection;
108
}
109
110
public
function
toRestFormat
(
array
$option
= []):
array
111
{
112
$linkCollection = [];
113
114
foreach
($this as $link)
115
{
116
$linkCollection[] = $link->toRestFormat(
$option
);
117
}
118
119
return
$linkCollection;
120
}
121
}
Bitrix\Im\V2\Entity\EntityCollection
Определения
EntityCollection.php:17
Bitrix\Im\V2\Entity\User\UserPopupItem
Определения
UserPopupItem.php:8
Bitrix\Im\V2\Link\BaseLinkCollection
Определения
BaseLinkCollection.php:19
Bitrix\Im\V2\Link\BaseLinkCollection\getRestEntityName
static getRestEntityName()
Определения
BaseLinkCollection.php:49
Bitrix\Im\V2\Link\BaseLinkCollection\toRestFormat
toRestFormat(array $option=[])
Определения
BaseLinkCollection.php:110
Bitrix\Im\V2\Link\BaseLinkCollection\setMessageInfo
setMessageInfo(Message $message)
Определения
BaseLinkCollection.php:66
Bitrix\Im\V2\Link\BaseLinkCollection\getCollectionElementClass
static getCollectionElementClass()
Bitrix\Im\V2\Link\BaseLinkCollection\getPopupData
getPopupData(array $excludedList=[])
Определения
BaseLinkCollection.php:25
Bitrix\Im\V2\Link\BaseLinkCollection\getEntityIds
getEntityIds()
Определения
BaseLinkCollection.php:76
Bitrix\Im\V2\Link\BaseLinkCollection\toRestFormatIdOnly
toRestFormatIdOnly()
Определения
BaseLinkCollection.php:54
Bitrix\Im\V2\Link\BaseLinkCollection\filterByDate
filterByDate(DateTime $date)
Определения
BaseLinkCollection.php:37
Bitrix\Im\V2\Link\BaseLinkCollection\getRelatedChatId
getRelatedChatId()
Определения
BaseLinkCollection.php:44
Bitrix\Im\V2\Link\BaseLinkItem
Определения
BaseLinkItem.php:18
Bitrix\Im\V2\Link\BaseLinkItem\getDateCreate
getDateCreate()
Определения
BaseLinkItem.php:133
Bitrix\Im\V2\Rest\PopupData
Определения
PopupData.php:6
Bitrix\Im\V2\TariffLimit\FilterResult
Определения
FilterResult.php:12
Bitrix\Main\ORM\Objectify\Collection
Определения
collection.php:33
Bitrix\Main\ORM\Objectify\Collection\count
count()
Определения
collection.php:1047
Bitrix\Main\Type\Date\getTimestamp
getTimestamp()
Определения
date.php:218
Bitrix\Main\Type\DateTime
Определения
datetime.php:9
$data
$data['IS_AVAILABLE']
Определения
.description.php:13
array
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения
file_new.php:804
$entity
$entity
Определения
group_bizproc_workflow_delete.php:17
Bitrix\Im\V2\Link\LinkRestConvertible
Определения
LinkRestConvertible.php:10
Bitrix\Im\V2\TariffLimit\DateFilterable
Определения
DateFilterable.php:8
Bitrix\Im\Message
Определения
Uuid.php:3
Bitrix\Im\V2\Chat\User
Определения
OwnerService.php:2
Bitrix\Im\V2\Entity
Bitrix\Im\V2\Link
Определения
BaseLinkCollection.php:3
Bitrix\Im\V2\Message
Определения
AdditionalMessagePopupItem.php:3
Bitrix\Main\Entity
Определения
ufield.php:9
$message
$message
Определения
payment.php:8
$option
$option
Определения
options.php:1711
bitrix
modules
im
lib
V2
Link
BaseLinkCollection.php
Создано системой
1.14.0