1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
PasswordRepository.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
6
12use Bitrix\Rest\Enum;
13use Bitrix\Rest\Model;
14use Bitrix\Rest;
16
18{
20 {
21 $model = $this->mapEntityToModel($password);
22 $result = $model->save();
23
24 if (!$result->isSuccess())
25 {
26 throw new Repository\Exception\CreationFailedException('Failed to create password');
27 }
28
29 $password->setId($model->getId());
30
31 return $password;
32 }
33
34 public function deleteById(int $id): bool
35 {
36 return PasswordTable::delete($id)->isSuccess();
37 }
38
40 {
41 $collection = PasswordTable::query()
42 ->setSelect(['*'])
43 ->setFilter(['=TYPE' => $type->value])
44 ->fetchCollection();
45
46 return $this->mapModelCollectionToEntityCollection($collection);
47 }
48
49 public function getById(int $id): ?Entity\APAuth\Password
50 {
51 $model = PasswordTable::getById($id)->fetchObject();
52
53 if ($model)
54 {
55 return $this->mapModelToEntity($model);
56 }
57
58 return null;
59 }
60
61 private function mapModelToEntity(APAuth\EO_Password $model): Entity\APAuth\Password
62 {
63 return (new Model\Mapper\APAuth\Password())->mapModelToEntity($model);
64 }
65
66 private function mapModelCollectionToEntityCollection(
67 APAuth\EO_Password_Collection $modelCollection
68 ): Entity\Collection\APAuth\PasswordCollection
69 {
70 return (new Model\Mapper\APAuth\PasswordCollection())->map($modelCollection);
71 }
72
73 private function mapEntityToModel(Entity\APAuth\Password $password): Rest\APAuth\EO_Password
74 {
75 return (new Model\Mapper\APAuth\Password())->mapEntityToModel($password);
76 }
77}
$type
Определения options.php:106
static getById($id)
Определения datamanager.php:364
static delete($primary)
Определения datamanager.php:1644
getByType(Enum\APAuth\PasswordType $type)
Определения PasswordRepository.php:39
create(Entity\APAuth\Password $password)
Определения PasswordRepository.php:19
$result
Определения get_property_values.php:14
Определения ufield.php:9
Определения handlers.php:8
$password
Определения mysql_to_pgsql.php:34
Определения accessexception.php:2