Bitrix-D7 23.9
 
Загрузка...
Поиск...
Не найдено
dataprovider.php
1<?php
10
14
16{
17 public function getEntity(string $type, int $id): Entity\AccessRightEntityInterface
18 {
19 $entityClass = $this->getEntityClassByType($type);
20 if (!$entityClass)
21 {
23 }
24
25 $entity = new $entityClass($id);
26
27 return $entity;
28 }
29
30 private function getEntityClassByType(string $type): ?string
31 {
32 switch ($type)
33 {
34 case (AccessCode::TYPE_OTHER):
35 return Entity\Other::class;
36 case (AccessCode::TYPE_USER):
37 return Entity\User::class;
38 case (AccessCode::TYPE_SOCNETGROUP):
39 return \Bitrix\Main\Loader::includeModule('socialnetwork') ? Entity\SocnetGroup::class : null;
40 case (AccessCode::TYPE_GROUP):
41 return Entity\Group::class;
42 case (AccessCode::TYPE_DEPARTMENT):
43 return Entity\Department::class;
44 case (AccessCode::TYPE_ACCESS_DIRECTOR):
45 return Entity\AccessDirector::class;
46 case (AccessCode::TYPE_ACCESS_EMPLOYEE):
47 return Entity\UserAll::class;
48 default:
49 return null;
50 }
51 }
52
53}