mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-29 19:13:49 +00:00
Add workflow title to notification emails for workflow transition, to user groups
Incorporated the workflow title into notification emails to provide more context to users. Updated the NotificationToUserGroupsOnTransition class and its tests to include the title from EntityWorkflowManager. Adjusted the French email templates to display the workflow title correctly.
This commit is contained in:
@@ -13,6 +13,7 @@ namespace Chill\MainBundle\Workflow\EventSubscriber;
|
||||
|
||||
use Chill\MainBundle\Entity\Notification;
|
||||
use Chill\MainBundle\Entity\Workflow\EntityWorkflow;
|
||||
use Chill\MainBundle\Workflow\EntityWorkflowManager;
|
||||
use Chill\MainBundle\Workflow\Helper\MetadataExtractor;
|
||||
use Doctrine\ORM\EntityManagerInterface;
|
||||
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
|
||||
@@ -29,6 +30,7 @@ final readonly class NotificationToUserGroupsOnTransition implements EventSubscr
|
||||
private Registry $registry,
|
||||
private MailerInterface $mailer,
|
||||
private EntityManagerInterface $entityManager,
|
||||
private EntityWorkflowManager $entityWorkflowManager,
|
||||
) {}
|
||||
|
||||
public static function getSubscribedEvents(): array
|
||||
@@ -62,6 +64,7 @@ final readonly class NotificationToUserGroupsOnTransition implements EventSubscr
|
||||
$workflow = $this->metadataExtractor->buildArrayPresentationForWorkflow(
|
||||
$this->registry->get($entityWorkflow, $entityWorkflow->getWorkflowName())
|
||||
);
|
||||
$title = $this->entityWorkflowManager->getHandler($entityWorkflow)->getEntityTitle($entityWorkflow);
|
||||
|
||||
$currentStep = $entityWorkflow->getCurrentStep();
|
||||
if (!$this->entityManager->contains($currentStep)) {
|
||||
@@ -81,6 +84,7 @@ final readonly class NotificationToUserGroupsOnTransition implements EventSubscr
|
||||
'place' => $place,
|
||||
'workflow' => $workflow,
|
||||
'is_dest' => true,
|
||||
'title' => $title,
|
||||
];
|
||||
|
||||
$email = new TemplatedEmail();
|
||||
|
Reference in New Issue
Block a user