1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
ViewCollection.php
См. документацию.
1<?php
2
4
10
12{
13 public static function find(
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}
static processFilters(Query $query, array $filter, array $order)
Определения ViewCollection.php:55
static find(array $filter, array $order=['ID'=> 'ASC'], ?int $limit=null, ?Context $context=null)
Определения ViewCollection.php:13
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
$query
Определения get_search.php:11
$filter
Определения iblock_catalog_list.php:54
$context
Определения csv_new_setup.php:223
Определения culture.php:9
Определения chain.php:3
$order
Определения payment.php:8