1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
indatabase.php
См. документацию.
1<?php
2
3namespace Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State;
4
5use Bitrix\Main\ORM\Query\Result;
6use Bitrix\Main\ORM\Query\Query;
7use Bitrix\Socialnetwork\Internals\LiveFeed\Counter;
8use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState;
9use Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterTable;
10
12{
13 private Query $query;
15 private array $current = [];
17 private int $key = 0;
19 private bool $valid = false;
20
21 private Result $ormQueryResult;
22
23 public function __construct(int $userId, Counter\Loader $loader)
24 {
25 parent::__construct($userId, $loader);
26
27 $this->queryInit($userId);
28 $this->next();
29 }
30
31 public function rewind(): void
32 {
33 $this->key = 0;
34 $this->queryInit($this->userId);
35 $this->next();
36 }
37
38 public function current()
39 {
40 return $this->current;
41 }
42
43 public function key(): int
44 {
45 return $this->key;
46 }
47
48 public function next(): void
49 {
50 $this->key++;
51 $row = $this->ormQueryResult->fetch();
52 if ($row === false)
53 {
54 $this->valid = false;
55 unset($this->ormQueryResult);
56 return;
57 }
58
59 $this->valid = true;
60 $this->current = $row;
61 }
62
63 public function valid(): bool
64 {
65 return $this->valid;
66 }
67
68 public function getSize(): int
69 {
70 return $this->query->queryCountTotal();
71 }
72
73 public function updateState(array $rawCounters, array $types = [], array $logIds = []): void
74 {
75 $this->updateRawCounters();
76 }
77
78 protected function loadCounters(): void
79 {
80 $this->updateRawCounters();
81 }
82
83 private function queryInit(int $userId)
84 {
85 $this->query = CounterTable::query()
86 ->setSelect([
87 'VALUE',
88 'SONET_LOG_ID',
89 'GROUP_ID',
90 'TYPE'
91 ])
92 ->where('USER_ID', $userId);
93
94 $this->ormQueryResult = $this->query->exec();
95 }
96}
if(!is_object($USER)||! $USER->IsAuthorized()) $userId
Определения check_mail.php:18
Определения result.php:20
Определения loader.php:13
__construct(int $userId, Counter\Loader $loader)
Определения indatabase.php:23
updateState(array $rawCounters, array $types=[], array $logIds=[])
Определения indatabase.php:73
</td ></tr ></table ></td ></tr >< tr >< td class="bx-popup-label bx-width30"><?=GetMessage("PAGE_NEW_TAGS")?> array( $site)
Определения file_new.php:804
Определения chain.php:3
if(empty($signedUserToken)) $key
Определения quickway.php:257