1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
UpdateGroupTypeHandler.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Collab\Converter\Handler;
6
7use Bitrix\Main\Error;
8use Bitrix\Main\Result;
9use Bitrix\Socialnetwork\Collab\Converter\Command\AbstractConverterCommand;
10use Bitrix\Socialnetwork\Item\Workgroup\AvatarType;
11use Bitrix\Socialnetwork\Item\Workgroup\Type;
12
14{
15 public function __construct(private readonly Type $type)
16 {
17 }
18
19 public function execute(AbstractConverterCommand $command): Result
20 {
21 $result = new Result();
22 $fields = ['TYPE' => $this->type->value];
23
24 if ($this->type === Type::Collab)
25 {
26 $fields['AVATAR_TYPE'] = AvatarType::None->value;
27 }
28 $updateResult = \CSocNetGroup::Update($command->getGroup()->getId(), $fields);
29
30 if ($updateResult === false)
31 {
32 $result->addError(new Error('Error updating group type.'));
33 }
34
35 return $result;
36 }
37}
$type
Определения options.php:106
Определения error.php:15
$result
Определения get_property_values.php:14
Определения collection.php:2
$fields
Определения yandex_run.php:501