Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
userconsentitem.php
1
<?php
8
namespace
Bitrix\Main\UserConsent\Internals
;
9
10
use
Bitrix\Main\Entity
;
11
use
Bitrix\Main\Localization\Loc
;
12
use
Bitrix\Main\ORM\Fields\Relations\Reference
;
13
use
Bitrix\Main\ORM\Query\Join
;
14
15
Loc::loadMessages
(__FILE__);
16
33
class
UserConsentItemTable
extends
Entity\DataManager
34
{
40
public
static
function
getTableName
()
41
{
42
return
'b_consent_user_consent_item'
;
43
}
44
53
public
static
function
getMap
()
54
{
55
return
[
56
'ID'
=> [
57
'data_type'
=>
'integer'
,
58
'primary'
=>
true
,
59
'autocomplete'
=>
true
,
60
],
61
'USER_CONSENT_ID'
=> [
62
'data_type'
=>
'integer'
,
63
'required'
=>
true
,
64
],
65
'VALUE'
=> [
66
'data_type'
=>
'text'
,
67
'required'
=>
true
,
68
],
69
(
new
Reference
(
70
'USER_CONSENT'
,
71
ConsentTable::class,
72
Join::on(
'this.USER_CONSENT_ID'
,
'ref.ID'
)
73
))
74
];
75
}
76
84
public
static
function
addItems
(
int
$userConsentId, array $items): void
85
{
86
foreach
($items as $item)
87
{
88
static::add([
89
'USER_CONSENT_ID'
=> $userConsentId,
90
'VALUE'
=> $item[
'VALUE'
],
91
]);
92
}
93
}
94
105
public
static
function
getItems
(
int
$userConsentId): array
106
{
107
$items = [];
108
109
$queryObject = static::getList([
110
'filter'
=> [
111
'=USER_CONSENT_ID'
=> $userConsentId
112
]
113
]);
114
while
($item = $queryObject->fetch())
115
{
116
$items[] = $item;
117
}
118
119
return
$items;
120
}
121
130
public
static
function
removeItems
(
int
$userConsentId): void
131
{
132
$queryObject = static::getList([
133
'select'
=> [
'ID'
],
134
'filter'
=> [
135
'=USER_CONSENT_ID'
=> $userConsentId
136
]
137
]);
138
while
($item = $queryObject->fetch())
139
{
140
static::delete($item[
'ID'
]);
141
}
142
}
143
}
Bitrix\Main\Localization\Loc
Definition
loc.php:11
Bitrix\Main\Localization\Loc\loadMessages
static loadMessages($file)
Definition
loc.php:64
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\Relations\Reference
Definition
reference.php:26
Bitrix\Main\ORM\Query\Join
Definition
join.php:19
Bitrix\Main\UserConsent\Internals\UserConsentItemTable
Definition
userconsentitem.php:34
Bitrix\Main\UserConsent\Internals\UserConsentItemTable\getMap
static getMap()
Definition
userconsentitem.php:53
Bitrix\Main\UserConsent\Internals\UserConsentItemTable\addItems
static addItems(int $userConsentId, array $items)
Definition
userconsentitem.php:84
Bitrix\Main\UserConsent\Internals\UserConsentItemTable\getItems
static getItems(int $userConsentId)
Definition
userconsentitem.php:105
Bitrix\Main\UserConsent\Internals\UserConsentItemTable\removeItems
static removeItems(int $userConsentId)
Definition
userconsentitem.php:130
Bitrix\Main\UserConsent\Internals\UserConsentItemTable\getTableName
static getTableName()
Definition
userconsentitem.php:40
Bitrix\Main\UserConsent\Internals
Definition
agreement.php:8
modules
main
lib
userconsent
internals
userconsentitem.php
Создано системой
1.10.0