From 0a19255a22f78d4e2f9ff0a6bfd9a4b04bb0cf89 Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Wed, 18 Jun 2025 14:30:23 +0200 Subject: [PATCH] Set type upon creation of automatic notifications --- .../Workflow/EventSubscriber/NotificationOnTransition.php | 4 +++- .../Events/PersonAddressMoveEventSubscriber.php | 4 +++- .../AccompanyingPeriod/Events/UserRefEventSubscriber.php | 4 +++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php index 17f5194cc..af8d0537e 100644 --- a/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php +++ b/src/Bundle/ChillMainBundle/Workflow/EventSubscriber/NotificationOnTransition.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\MainBundle\Workflow\EventSubscriber; use Chill\MainBundle\Entity\Notification; +use Chill\MainBundle\Entity\NotificationEnum; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Entity\UserGroup; use Chill\MainBundle\Entity\Workflow\EntityWorkflow; @@ -125,7 +126,8 @@ class NotificationOnTransition implements EventSubscriberInterface ->setRelatedEntityClass(EntityWorkflow::class) ->setTitle($this->engine->render('@ChillMain/Workflow/workflow_notification_on_transition_completed_title.fr.txt.twig', $context)) ->setMessage($this->engine->render('@ChillMain/Workflow/workflow_notification_on_transition_completed_content.fr.txt.twig', $context)) - ->addAddressee($subscriber); + ->addAddressee($subscriber) + ->setType(NotificationEnum::WORKFLOW_TRANS); $this->entityManager->persist($notification); } } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php index 64d2b8f12..a5135971f 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/PersonAddressMoveEventSubscriber.php @@ -13,6 +13,7 @@ namespace Chill\PersonBundle\AccompanyingPeriod\Events; use Chill\MainBundle\Entity\Address; use Chill\MainBundle\Entity\Notification; +use Chill\MainBundle\Entity\NotificationEnum; use Chill\MainBundle\Notification\NotificationPersisterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; use Chill\PersonBundle\Event\Person\PersonAddressMoveEvent; @@ -65,7 +66,8 @@ class PersonAddressMoveEventSubscriber implements EventSubscriberInterface ->setMessage($this->engine->render('@ChillPerson/AccompanyingPeriod/notification_location_user_on_period_has_moved.fr.txt.twig', [ 'oldPersonLocation' => $person, 'period' => $period, - ])); + ])) + ->setType(NotificationEnum::PERSON_MOVE); $this->notificationPersister->persist($notification); } diff --git a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php index 084fe8ff5..e99bb44b5 100644 --- a/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php +++ b/src/Bundle/ChillPersonBundle/AccompanyingPeriod/Events/UserRefEventSubscriber.php @@ -12,6 +12,7 @@ declare(strict_types=1); namespace Chill\PersonBundle\AccompanyingPeriod\Events; use Chill\MainBundle\Entity\Notification; +use Chill\MainBundle\Entity\NotificationEnum; use Chill\MainBundle\Entity\User; use Chill\MainBundle\Notification\NotificationPersisterInterface; use Chill\PersonBundle\Entity\AccompanyingPeriod; @@ -73,7 +74,8 @@ class UserRefEventSubscriber implements EventSubscriberInterface 'accompanyingCourse' => $period, ] )) - ->addAddressee($period->getUser()); + ->addAddressee($period->getUser()) + ->setType(NotificationEnum::REFERRER_ACC_COURSE); $this->notificationPersister->persist($notification); }