1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
PermissionRepository.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Rest\Repository\APAuth;
6
7
use Bitrix\Rest\Entity;
8
use Bitrix\Rest;
9
use Bitrix\Rest\Repository;
10
use Bitrix\Rest\Model\Mapper;
11
use Bitrix\Rest\Contract;
12
13
class
PermissionRepository
implements
Contract\Repository\APAuth\PermissionRepository
14
{
15
public
function
create
(
Entity
\
APAuth
\Permission $permission):
Entity
\
APAuth
\Permission
16
{
17
$result
= $this->mapEntityToModel($permission)->save();
18
19
if
(!
$result
->isSuccess())
20
{
21
throw
new
Repository\Exception\CreationFailedException
(
'Failed to create permission'
);
22
}
23
24
$permission->setId(
$result
->getId());
25
26
return
$permission;
27
}
28
29
public
function
deleteByPasswordId
(
int
$passwordId): bool
30
{
31
try
32
{
33
Rest\APAuth\PermissionTable::deleteByPasswordId
($passwordId);
34
35
return
true
;
36
}
37
catch
(\
Exception
)
38
{
39
return
false
;
40
}
41
}
42
43
private
function
mapEntityToModel(
Entity
\
APAuth
\Permission $permission):
Rest
\
APAuth
\
EO_Permission
44
{
45
return
(
new
Mapper
\
APAuth
\Permission())->mapEntityToModel($permission);
46
}
47
48
private
function
mapModelToEntity(
Rest
\
APAuth
\
EO_Permission
$model):
Entity
\
APAuth
\Permission
49
{
50
return
(
new
Mapper\
APAuth
\Permission())->mapModelToEntity($model);
51
}
52
}
Bitrix\Rest\APAuth\EO_Permission
Определения
orm.php:2573
Bitrix\Rest\APAuth\PermissionTable\deleteByPasswordId
static deleteByPasswordId($passwordId)
Определения
permission.php:90
Bitrix\Rest\Repository\APAuth\PermissionRepository
Определения
PermissionRepository.php:14
Bitrix\Rest\Repository\APAuth\PermissionRepository\deleteByPasswordId
deleteByPasswordId(int $passwordId)
Определения
PermissionRepository.php:29
Bitrix\Rest\Repository\APAuth\PermissionRepository\create
create(Entity\APAuth\Permission $permission)
Определения
PermissionRepository.php:15
Bitrix\Rest\Repository\Exception\CreationFailedException
Определения
CreationFailedException.php:8
$result
$result
Определения
get_property_values.php:14
Bitrix\Rest\Contract\Repository\APAuth\PermissionRepository
Определения
PermissionRepository.php:11
Bitrix\Main\DI\Exception
Определения
circulardependencyexception.php:3
Bitrix\Main\Entity
Определения
ufield.php:9
Bitrix\Main\Rest
Определения
handlers.php:8
Bitrix\Rest\APAuth
Определения
application.php:9
Bitrix\Rest\Model\Mapper
Bitrix\Rest\Repository\APAuth
Определения
PasswordRepository.php:5
bitrix
modules
rest
lib
Repository
APAuth
PermissionRepository.php
Создано системой
1.14.0