Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
indatabase.php
1
<?php
2
3
namespace
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State
;
4
5
use
Bitrix\Main\ORM\Query\Result
;
6
use
Bitrix\Main\ORM\Query\Query
;
7
use
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
;
8
use
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState
;
9
use
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterTable
;
10
11
class
InDatabase
extends
CounterState
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
}
Bitrix\Main\ORM\Data\Result
Definition
result.php:16
Bitrix\Main\ORM\Query\Query
Definition
query.php:118
Bitrix\Main\ORM\Query\Result
Definition
result.php:34
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState
Definition
counterstate.php:9
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState\$userId
int $userId
Definition
counterstate.php:12
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterState\updateRawCounters
updateRawCounters()
Definition
counterstate.php:100
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\CounterTable
Definition
countertable.php:26
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\Loader
Definition
loader.php:13
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase
Definition
indatabase.php:12
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\loadCounters
loadCounters()
Definition
indatabase.php:78
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\__construct
__construct(int $userId, Counter\Loader $loader)
Definition
indatabase.php:23
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\key
key()
Definition
indatabase.php:43
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\getSize
getSize()
Definition
indatabase.php:68
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\valid
valid()
Definition
indatabase.php:63
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\next
next()
Definition
indatabase.php:48
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\updateState
updateState(array $rawCounters, array $types=[], array $logIds=[])
Definition
indatabase.php:73
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\rewind
rewind()
Definition
indatabase.php:31
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State\InDatabase\current
current()
Definition
indatabase.php:38
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
Definition
counter.php:12
Bitrix\Socialnetwork\Internals\LiveFeed\Counter\State
Definition
factory.php:3
Bitrix\Socialnetwork\Internals\LiveFeed\Counter
modules
socialnetwork
lib
internals
livefeed
counter
state
indatabase.php
Создано системой
1.10.0