1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
DeleteOptionsHandler.php
См. документацию.
1<?php
2
3declare(strict_types=1);
4
5namespace Bitrix\Socialnetwork\Collab\Control\Handler\Delete;
6
7use Bitrix\Main\DI\ServiceLocator;
8use Bitrix\Main\Error;
9use Bitrix\Main\ObjectNotFoundException;
10use Bitrix\Socialnetwork\Collab\Collab;
11use Bitrix\Socialnetwork\Collab\Control\Command\CollabDeleteCommand;
12use Bitrix\Socialnetwork\Collab\Control\Option\Command\DeleteOptionsCommand;
13use Bitrix\Socialnetwork\Control\Command\DeleteCommand;
14use Bitrix\Socialnetwork\Control\Handler\Delete\DeleteHandlerInterface;
15use Bitrix\Socialnetwork\Control\Handler\HandlerResult;
16use Bitrix\Socialnetwork\Item\Workgroup;
17use Psr\Container\NotFoundExceptionInterface;
18
20{
25 public function delete(DeleteCommand $command, Workgroup $entityBefore): HandlerResult
26 {
27 $result = new HandlerResult();
28 if (!$command instanceof CollabDeleteCommand || !$entityBefore instanceof Collab)
29 {
30 $result->addError(new Error('Unexpected command type'));
31
32 return $result;
33 }
34
35 $optionCommand = (new DeleteOptionsCommand())
36 ->setCollabId($command->getId());
37
38 $service = ServiceLocator::getInstance()->get('socialnetwork.collab.option.service');
39
40 $optionResult = $service->delete($optionCommand);
41
42 return $result->merge($optionResult);
43 }
44}
Определения error.php:15
$result
Определения get_property_values.php:14
$service
Определения payment.php:18