3declare(strict_types=1);
5namespace Bitrix\Socialnetwork\Control\Decorator;
7use Bitrix\Socialnetwork\Control\Command\AddCommand;
8use Bitrix\Socialnetwork\Control\Command\DeleteCommand;
9use Bitrix\Socialnetwork\Control\Command\UpdateCommand;
10use Bitrix\Socialnetwork\Control\Exception\GroupNotAddedException;
11use Bitrix\Socialnetwork\Control\Exception\GroupNotDeletedException;
12use Bitrix\Socialnetwork\Control\Exception\GroupNotUpdatedException;
13use Bitrix\Socialnetwork\Control\GroupResult;
25 if ($controller ===
null)
30 $model = $controller->getModel($command);
31 $action = $controller->getDictionary()->create();
33 if (!$controller->check(
$action, $model))
35 $result->addErrors($controller->getErrors());
37 return $this->source->finalizeAddResult(
$result);
40 return $this->source->add($command);
51 if ($controller ===
null)
56 $action = $controller->getDictionary()->update();
57 $model = $controller->getModel($command);
58 $entity = $this->source->registry->get($command->getId());
62 $result->addErrors($controller->getErrors());
64 return $this->source->finalizeUpdateResult(
$result);
67 return $this->source->update($command);
77 $controller = $command->getAccessControllerByInitiator();
78 if ($controller ===
null)
83 $action = $controller->getDictionary()->delete();
85 if (!$controller->checkByItemId(
$action, $command->getId()))
87 $result->addErrors($controller->getErrors());
92 return $this->source->delete($command);
finalizeDeleteResult(GroupResult $result)
getAccessControllerByInitiator()
update(UpdateCommand $command)