1C-Bitrix
25.700.0
Загрузка...
Поиск...
Не найдено
AddOperation.php
См. документацию.
1
<?php
2
3
declare(strict_types=1);
4
5
namespace
Bitrix\Socialnetwork\Control\Operation;
6
7
use Bitrix\Main\Error;
8
use Bitrix\Socialnetwork\Control\Command\AddCommand;
9
use Bitrix\Socialnetwork\Control\Exception\GroupNotAddedException;
10
use Bitrix\Socialnetwork\Control\GroupResult;
11
use Bitrix\Socialnetwork\Item\Workgroup;
12
use CSocNetGroup;
13
14
class
AddOperation
extends
AbstractOperation
15
{
16
protected
AddCommand
$command
;
17
protected
Workgroup
$entity
;
18
19
public
function
__construct
(
AddCommand
$command
)
20
{
21
$this->command =
$command
;
22
}
23
24
public
function
run
():
GroupResult
25
{
26
$result
=
new
GroupResult
();
27
28
$fields
= $this->
getMapper
()->toArray($this->command);
29
30
$id = (int)CSocNetGroup::createGroup($this->command->getOwnerId(),
$fields
);
31
32
if
($id === 0)
33
{
34
$result
->addApplicationError();
35
36
return
$result
;
37
}
38
39
$group = $this->
getRegistry
()->get($id);
40
if
($group ===
null
)
41
{
42
$result
->addError(
new
Error
(
'Group not found'
));
43
44
return
$result
;
45
}
46
47
$this->entity = $group;
48
49
$result
->setGroup($this->entity);
50
51
return
$result
;
52
}
53
}
Bitrix\Main\Error
Определения
error.php:15
Bitrix\Socialnetwork\Control\Command\AddCommand
Определения
AddCommand.php:61
Bitrix\Socialnetwork\Control\GroupResult
Определения
GroupResult.php:12
Bitrix\Socialnetwork\Control\Operation\AbstractOperation
Определения
AbstractOperation.php:12
Bitrix\Socialnetwork\Control\Operation\AbstractOperation\getMapper
getMapper()
Определения
AbstractOperation.php:18
Bitrix\Socialnetwork\Control\Operation\AbstractOperation\getRegistry
getRegistry()
Определения
AbstractOperation.php:25
Bitrix\Socialnetwork\Control\Operation\AddOperation
Определения
AddOperation.php:15
Bitrix\Socialnetwork\Control\Operation\AddOperation\__construct
__construct(AddCommand $command)
Определения
AddOperation.php:19
Bitrix\Socialnetwork\Control\Operation\AddOperation\$command
AddCommand $command
Определения
AddOperation.php:16
Bitrix\Socialnetwork\Control\Operation\AddOperation\$entity
Workgroup $entity
Определения
AddOperation.php:17
Bitrix\Socialnetwork\Control\Operation\AddOperation\run
run()
Определения
AddOperation.php:24
$result
$result
Определения
get_property_values.php:14
Bitrix\Socialnetwork\Helper\Workgroup
Определения
access.php:9
$fields
$fields
Определения
yandex_run.php:501
bitrix
modules
socialnetwork
lib
Control
Operation
AddOperation.php
Создано системой
1.14.0