Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
access.php
1
<?php
2
3
namespace
Bitrix\Sender\Internals\Model\Role
;
4
5
use
Bitrix\Main\ArgumentException
;
6
use
Bitrix\Main\Application
;
7
use
Bitrix\Main\Entity
;
8
27
class
AccessTable
extends
Entity\DataManager
28
{
35
public
static
function
getTableName
()
36
{
37
return
'b_sender_role_access'
;
38
}
39
46
public
static
function
getMap
()
47
{
48
return
array(
49
'ID'
=>
new
Entity
\
IntegerField
(
'ID'
, array(
50
'primary'
=>
true
,
51
'autocomplete'
=>
true
,
52
)),
53
'ROLE_ID'
=>
new
Entity
\
IntegerField
(
'ROLE_ID'
, array(
54
'required'
=>
true
,
55
)),
56
'ACCESS_CODE'
=>
new
Entity
\
StringField
(
'ACCESS_CODE'
, array(
57
'required'
=>
true
,
58
)),
59
'ROLE'
=>
new
Entity
\ReferenceField(
60
'ROLE'
,
'Bitrix\Sender\Access\Role\Role'
,
61
array(
'=this.ROLE_ID'
=>
'ref.ID'
),
62
array(
'join_type'
=>
'INNER'
)
63
)
64
);
65
}
66
72
public
static
function
truncate
()
73
{
74
$sql =
"TRUNCATE TABLE "
.
self::getTableName
();
75
Application::getConnection
()->queryExecute($sql);
76
77
$result =
new
Entity\DeleteResult
();
78
return
$result;
79
}
80
88
public
static
function
deleteByRoleId
($roleId)
89
{
90
$roleId = (int) $roleId;
91
if
($roleId <= 0)
92
{
93
throw
new
ArgumentException
(
'Role id should be greater than zero'
,
'roleId'
);
94
}
95
96
$sql =
"DELETE FROM "
.
self::getTableName
() .
" WHERE ROLE_ID = "
. $roleId;
97
Application::getConnection
()->queryExecute($sql);
98
99
$result =
new
Entity\DeleteResult
();
100
return
$result;
101
}
102
}
Bitrix\Main\Application
Definition
application.php:28
Bitrix\Main\Application\getConnection
static getConnection($name="")
Definition
application.php:611
Bitrix\Main\ArgumentException
Definition
exception.php:34
Bitrix\Main\ORM\Data\DeleteResult
Definition
deleteresult.php:12
Bitrix\Main\ORM\Entity
Definition
entity.php:26
Bitrix\Main\ORM\Fields\IntegerField
Definition
integerfield.php:20
Bitrix\Main\ORM\Fields\StringField
Definition
stringfield.php:20
Bitrix\Sender\Internals\Model\Role\AccessTable
Definition
access.php:28
Bitrix\Sender\Internals\Model\Role\AccessTable\deleteByRoleId
static deleteByRoleId($roleId)
Definition
access.php:88
Bitrix\Sender\Internals\Model\Role\AccessTable\getMap
static getMap()
Definition
access.php:46
Bitrix\Sender\Internals\Model\Role\AccessTable\truncate
static truncate()
Definition
access.php:72
Bitrix\Sender\Internals\Model\Role\AccessTable\getTableName
static getTableName()
Definition
access.php:35
Bitrix\Sender\Internals\Model\Role
Definition
access.php:3
modules
sender
lib
internals
model
role
access.php
Создано системой
1.10.0