Bitrix-D7
23.9
Загрузка...
Поиск...
Не найдено
User.php
1
<?php
2
3
namespace
Bitrix\Im\V2\Controller
;
4
5
use
Bitrix\Im\V2\Entity
;
6
use
Bitrix\Main\Engine\AutoWire\ExactParameter
;
7
8
class
User
extends
BaseController
9
{
10
public
function
getPrimaryAutoWiredParameter
()
11
{
12
return
new
ExactParameter
(
13
Entity
\
User
\
User::class
,
14
'user'
,
15
function
($className,
int
$id) {
16
return
$this->
getUserById
($id);
17
}
18
);
19
}
20
24
public
function
getDepartmentAction
(
Entity
\
User
\
User
$user): ?array
25
{
26
$department = $user->getDepartments()->filterExist()->getDeepest()->getAny();
27
28
if
($department ===
null
)
29
{
30
return
null
;
31
}
32
33
return
$this->
toRestFormat
($department);
34
}
35
36
protected
function
getUserById
(
int
$id): ?
Entity
\
User
\
User
37
{
38
$user = Entity\User\User::getInstance($id);
39
40
if
(!$user->isExist())
41
{
42
$this->
addError
(
new
Entity
\
User
\UserError(
Entity
\
User
\UserError::NOT_FOUND));
43
44
return
null
;
45
}
46
47
return
$user;
48
}
49
}
Bitrix\Im\User
Definition
user.php:10
Bitrix\Im\V2\Controller\BaseController
Definition
BaseController.php:24
Bitrix\Im\V2\Controller\BaseController\toRestFormat
toRestFormat(RestConvertible ... $entities)
Definition
BaseController.php:78
Bitrix\Im\V2\Controller\User\getPrimaryAutoWiredParameter
getPrimaryAutoWiredParameter()
Definition
User.php:10
Bitrix\Im\V2\Controller\User\getUserById
getUserById(int $id)
Definition
User.php:36
Bitrix\Im\V2\Controller\User\getDepartmentAction
getDepartmentAction(Entity\User\User $user)
Definition
User.php:24
Bitrix\Main\DB\Connection\$host
$host
Definition
connection.php:29
Bitrix\Main\Engine\AutoWire\ExactParameter
Definition
exactparameter.php:9
Bitrix\Main\Engine\Controller\addError
addError(Error $error)
Definition
controller.php:1051
Bitrix\Im\V2\Entity
Definition
Entity.php:6
Bitrix\Im\V2\Controller
Definition
BaseController.php:3
Bitrix\Im\V2\Entity
modules
im
lib
V2
Controller
User.php
Создано системой
1.10.0