1C-Bitrix 25.700.0
Загрузка...
Поиск...
Не найдено
DeleteLastActivityHandler.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\Socialnetwork\Collab\Collab;
10use Bitrix\Socialnetwork\Collab\Control\Activity\Command\DeleteLastActivityCommand;
11use Bitrix\Socialnetwork\Collab\Control\Command\CollabDeleteCommand;
12use Bitrix\Socialnetwork\Control\Command\DeleteCommand;
13use Bitrix\Socialnetwork\Control\Handler\Delete\DeleteHandlerInterface;
14use Bitrix\Socialnetwork\Control\Handler\HandlerResult;
15use Bitrix\Socialnetwork\Item\Workgroup;
16
18{
19 public function delete(DeleteCommand $command, Workgroup $entityBefore): HandlerResult
20 {
21 $result = new HandlerResult();
22 if (!$command instanceof CollabDeleteCommand || !$entityBefore instanceof Collab)
23 {
24 $result->addError(new Error('Unexpected command type'));
25
26 return $result;
27 }
28
29 $service = ServiceLocator::getInstance()->get('socialnetwork.collab.activity.service');
30
31 $activityCommand = (new DeleteLastActivityCommand())
32 ->setCollabId($command->getId());
33
34 $activityResult = $service->delete($activityCommand);
35
36 return $result->merge($activityResult);
37 }
38}
Определения error.php:15
$result
Определения get_property_values.php:14
$service
Определения payment.php:18