mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-09-05 22:35:01 +00:00
Add message handling for public view creation
Introduce `PostPublicViewMessage` and `PostPublicViewMessageHandler` to handle external user views on public links by applying workflow transitions. Integrate with `WorkflowViewSendPublicController` and add relevant tests.
This commit is contained in:
@@ -15,6 +15,7 @@ use Chill\MainBundle\Entity\Workflow\EntityWorkflowSend;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflowSendView;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
||||
use Chill\MainBundle\Workflow\Exception\HandlerWithPublicViewNotFoundException;
|
||||
use Chill\MainBundle\Workflow\Messenger\PostPublicViewMessage;
|
||||
use Chill\MainBundle\Workflow\Templating\EntityWorkflowViewMetadataDTO;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Psr\Log\LoggerInterface;
|
||||
@@ -22,6 +23,7 @@ use Symfony\Component\Clock\ClockInterface;
|
||||
use Symfony\Component\HttpFoundation\Request;
|
||||
use Symfony\Component\HttpFoundation\Response;
|
||||
use Symfony\Component\HttpKernel\Exception\AccessDeniedHttpException;
|
||||
use Symfony\Component\Messenger\MessageBusInterface;
|
||||
use Symfony\Component\Routing\Annotation\Route;
|
||||
use Twig\Environment;
|
||||
|
||||
@@ -35,6 +37,7 @@ final readonly class WorkflowViewSendPublicController
|
||||
private EntityWorkflowManager $entityWorkflowManager,
|
||||
private ClockInterface $clock,
|
||||
private Environment $environment,
|
||||
private MessageBusInterface $messageBus,
|
||||
) {}
|
||||
|
||||
#[Route('/public/main/workflow/send/{uuid}/view/{verificationKey}', name: 'chill_main_workflow_send_view_public', methods: ['GET'])]
|
||||
@@ -75,6 +78,7 @@ final readonly class WorkflowViewSendPublicController
|
||||
|
||||
$view = new EntityWorkflowSendView($workflowSend, $this->clock->now(), $request->getClientIp());
|
||||
$this->entityManager->persist($view);
|
||||
$this->messageBus->dispatch(new PostPublicViewMessage($view->getId()));
|
||||
$this->entityManager->flush();
|
||||
|
||||
return $response;
|
||||
|
Reference in New Issue
Block a user