1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
AddOperation.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Control\Operation;
6
7use Bitrix\Main\Error;
8use Bitrix\Socialnetwork\Control\Command\AddCommand;
9use Bitrix\Socialnetwork\Control\Exception\GroupNotAddedException;
10use Bitrix\Socialnetwork\Control\GroupResult;
11use Bitrix\Socialnetwork\Item\Workgroup;
12use CSocNetGroup;
13
15{
17 protected Workgroup $entity;
18
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}
Определения error.php:15
__construct(AddCommand $command)
Определения AddOperation.php:19
$result
Определения get_property_values.php:14
$fields
Определения yandex_run.php:501