32 if (!$validationResult->isSuccess())
34 return $result->addErrors($validationResult->getErrors());
37 $entityBefore = $command->getGroup();
39 $this->connection->startTransaction();
43 $handlersResult = $this->runHandlers($command);
45 if (!$handlersResult->isSuccess())
47 $this->revertChanges($command->getGroup()->getId());
49 return $result->addErrors($handlersResult->getErrors());
52 GroupRegistry::getInstance()->invalidate($command->getGroup()->getId());
53 $entityAfter = GroupRegistry::getInstance()->get($entityBefore->getId());
57 $this->revertChanges($command->getGroup()->getId());
59 return $result->addError(
new Error(
'Group not found after conversion'));
62 $this->connection->commitTransaction();
64 catch (\Throwable $exception)
66 $this->revertChanges($command->getGroup()->getId());
68 return $result->addError(Error::createFromThrowable($exception));
71 (
new ConverterEvent($command, $entityBefore, $entityAfter))->send();
74 'GROUP_ID' => $command->getGroup()->getId(),
77 return $result->setEntityAfter($entityAfter);