Layout for the email to external

This commit is contained in:
2024-10-10 12:41:57 +02:00
parent 292034d64d
commit 8589bada3f
4 changed files with 105 additions and 6 deletions

View File

@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Workflow\Messenger;
use Chill\MainBundle\Entity\Workflow\EntityWorkflowSend;
use Chill\MainBundle\Repository\Workflow\EntityWorkflowRepository;
use Chill\MainBundle\Workflow\EntityWorkflowManager;
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
use Symfony\Component\Mailer\MailerInterface;
use Symfony\Component\Messenger\Exception\UnrecoverableMessageHandlingException;
@@ -25,6 +26,7 @@ final readonly class PostSendExternalMessageHandler implements MessageHandlerInt
private EntityWorkflowRepository $entityWorkflowRepository,
private MailerInterface $mailer,
private BodyRendererInterface $bodyRenderer,
private EntityWorkflowManager $workflowManager,
) {}
public function __invoke(PostSendExternalMessage $message): void
@@ -42,9 +44,12 @@ final readonly class PostSendExternalMessageHandler implements MessageHandlerInt
private function sendEmailToDestinee(EntityWorkflowSend $send, PostSendExternalMessage $message): void
{
$entityWorkflow = $send->getEntityWorkflowStep()->getEntityWorkflow();
$title = $this->workflowManager->getHandler($entityWorkflow)->getEntityTitle($entityWorkflow);
$email = new TemplatedEmail();
$email
->to($send->getDestineeThirdParty()?->getEmail() ?? $send->getDestineeEmail())
->subject($title)
->htmlTemplate('@ChillMain/Workflow/workflow_send_external_email_to_destinee.html.twig')
->context([
'send' => $send,