fixup! Add message handling for public view creation

This commit is contained in:
2024-10-10 09:39:45 +02:00
parent 9d722110a6
commit c329a1f1f8
2 changed files with 26 additions and 3 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Workflow\Messenger;
use Chill\MainBundle\Repository\EntityWorkflowSendViewRepository;
use Chill\MainBundle\Workflow\WorkflowTransitionContextDTO;
use Doctrine\ORM\EntityManagerInterface;
use Psr\Log\LoggerInterface;
use Symfony\Component\Messenger\Handler\MessageHandlerInterface;
use Symfony\Component\Workflow\Registry;
@@ -32,6 +33,7 @@ final readonly class PostPublicViewMessageHandler implements MessageHandlerInter
private EntityWorkflowSendViewRepository $sendViewRepository,
private Registry $registry,
private LoggerInterface $logger,
private EntityManagerInterface $entityManager,
) {}
public function __invoke(PostPublicViewMessage $message): void
@@ -51,6 +53,8 @@ final readonly class PostPublicViewMessageHandler implements MessageHandlerInter
'entityWorkflow' => $entityWorkflow->getId(),
]);
$this->entityManager->clear();
return;
}
@@ -70,6 +74,9 @@ final readonly class PostPublicViewMessageHandler implements MessageHandlerInter
'transition' => $placeMetadata[self::TRANSITION_ON_VIEW],
]);
$this->entityManager->flush();
$this->entityManager->clear();
return;
}
$this->logger->info(self::LOG_PREFIX.'Not able to apply this transition', ['transition' => $placeMetadata[self::TRANSITION_ON_VIEW],
@@ -77,5 +84,7 @@ final readonly class PostPublicViewMessageHandler implements MessageHandlerInter
}
}
$this->entityManager->clear();
}
}