1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
ViewCollection.php
См. документацию.
1
<?php
2
3
namespace
Bitrix\Im\V2\Entity\View
;
4
5
use
Bitrix\Im\Model\EO_MessageViewed_Collection
;
6
use
Bitrix\Im\Model\MessageViewedTable
;
7
use
Bitrix\Im\V2\Entity\EntityCollection
;
8
use
Bitrix\Im\V2\Service\Context
;
9
use
Bitrix\Main\ORM\Query\Query
;
10
11
class
ViewCollection
extends
EntityCollection
12
{
13
public
static
function
find
(
14
array
$filter
,
15
array
$order
= [
'ID'
=>
'ASC'
],
16
?
int
$limit =
null
,
17
?
Context
$context
=
null
18
)
19
{
20
$viewOrder = [
'ID'
=>
'ASC'
];
21
22
if
(isset(
$order
[
'ID'
]))
23
{
24
$viewOrder[
'ID'
] =
$order
[
'ID'
];
25
}
26
27
$query
= MessageViewedTable::query()
28
->setSelect([
'ID'
,
'USER_ID'
,
'MESSAGE_ID'
,
'DATE_CREATE'
])
29
->setOrder($viewOrder)
30
;
31
if
(isset($limit))
32
{
33
$query
->setLimit($limit);
34
}
35
static::processFilters(
$query
,
$filter
, $viewOrder);
36
37
return
(
new
static
())->initByEntityCollection(
$query
->fetchCollection());
38
}
39
40
public
static
function
getRestEntityName
(): string
41
{
42
return
'views'
;
43
}
44
45
private
function
initByEntityCollection(
EO_MessageViewed_Collection
$collection): self
46
{
47
foreach
($collection as $item)
48
{
49
$this[] =
new
ViewItem
($item->getId(), $item->getMessageId(), $item->getUserId(), $item->getDateCreate());
50
}
51
52
return
$this;
53
}
54
55
protected
static
function
processFilters
(
Query
$query
,
array
$filter
,
array
$order
)
56
{
57
if
(isset(
$filter
[
'LAST_ID'
]))
58
{
59
$operator =
$order
[
'ID'
] ===
'DESC'
?
'<'
:
'>'
;
60
$query
->where(
'ID'
, $operator,
$filter
[
'LAST_ID'
]);
61
}
62
if
(isset(
$filter
[
'MESSAGE_ID'
]))
63
{
64
$query
->where(
'MESSAGE_ID'
, (
int
)
$filter
[
'MESSAGE_ID'
]);
65
}
66
}
67
}
Bitrix\Im\Model\EO_MessageViewed_Collection
Определения
orm.php:2945
Bitrix\Im\Model\MessageViewedTable
Определения
messageviewed.php:45
Bitrix\Im\V2\Entity\EntityCollection
Определения
EntityCollection.php:17
Bitrix\Im\V2\Entity\View\ViewCollection
Определения
ViewCollection.php:12
Bitrix\Im\V2\Entity\View\ViewCollection\getRestEntityName
static getRestEntityName()
Определения
ViewCollection.php:40
Bitrix\Im\V2\Entity\View\ViewCollection\processFilters
static processFilters(Query $query, array $filter, array $order)
Определения
ViewCollection.php:55
Bitrix\Im\V2\Entity\View\ViewCollection\find
static find(array $filter, array $order=['ID'=> 'ASC'], ?int $limit=null, ?Context $context=null)
Определения
ViewCollection.php:13
Bitrix\Im\V2\Entity\View\ViewItem
Определения
ViewItem.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
$query
$query
Определения
get_search.php:11
$filter
$filter
Определения
iblock_catalog_list.php:54
$context
$context
Определения
csv_new_setup.php:223
Bitrix\Im\V2\Entity\View
Определения
ViewCollection.php:3
Bitrix\Main\Context
Определения
culture.php:9
Bitrix\Main\ORM\Query
Определения
chain.php:3
$order
$order
Определения
payment.php:8
bitrix
modules
im
lib
V2
Entity
View
ViewCollection.php
Создано системой
1.14.0