1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UpdateOperation.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Control\Operation;
6
7use Bitrix\Main\ArgumentException;
8use Bitrix\Main\Error;
9use Bitrix\Main\ObjectPropertyException;
10use Bitrix\Main\SystemException;
11use Bitrix\Socialnetwork\Control\Command\UpdateCommand;
12use Bitrix\Socialnetwork\Control\Exception\GroupNotUpdatedException;
13use Bitrix\Socialnetwork\Control\GroupResult;
14use Bitrix\Socialnetwork\Item\Workgroup;
15use CSocNetGroup;
16
18{
20 protected Workgroup $entity;
21
23 {
24 $this->command = $command;
25 }
26
27 public function run(): GroupResult
28 {
29 $result = new GroupResult();
30
31 $fields = $this->getMapper()->toArray($this->command);
32 if ($fields !== [])
33 {
34 $updateResult = CSocNetGroup::Update($this->command->getId(), $fields);
35
36 if ($updateResult === false)
37 {
38 $result->addApplicationError();
39
40 return $result;
41 }
42 }
43
44 $group = $this->getRegistry()->get($this->command->getId());
45 if ($group === null)
46 {
47 $result->addError(new Error('Group not found'));
48
49 return $result;
50 }
51
52 $this->entity = $group;
53
54 $result->setGroup($this->entity);
55
56 return $result;
57 }
58}
Определения error.php:15
$result
Определения get_property_values.php:14
$fields
Определения yandex_run.php:501