From c9c565809a522f83c879713279c57ece2bcd914b Mon Sep 17 00:00:00 2001 From: Julie Lenaerts Date: Tue, 10 Jun 2025 14:32:05 +0200 Subject: [PATCH] Create notification flag providers --- ...mpanyingCourseNotificationFlagProvider.php | 20 +++++++++ ...CourseWorkEvalNotificationFlagProvider.php | 20 +++++++++ ...yingCourseWorkNotificationFlagProvider.php | 20 +++++++++ .../ActivityNotificationFlagProvider.php | 20 +++++++++ ...gnatedReferrerNotificationFlagProvider.php | 20 +++++++++ .../NotificationFlagProviderInterface.php | 23 ++++++++++ ...sonAddressMoveNotificationFlagProvider.php | 20 +++++++++ .../PersonNotificationFlagProvider.php | 20 +++++++++ ...flowTransitionNotificationFlagProvider.php | 20 +++++++++ .../Notification/NotificationFlagManager.php | 44 +++++++++++++++++++ .../config/services/notification.yaml | 4 ++ 11 files changed, 231 insertions(+) create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseWorkEvalNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseWorkNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/ActivityNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/DesignatedReferrerNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/NotificationFlagProviderInterface.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/PersonAddressMoveNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/PersonNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/FlagProviders/WorkflowTransitionNotificationFlagProvider.php create mode 100644 src/Bundle/ChillMainBundle/Notification/NotificationFlagManager.php diff --git a/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php b/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php new file mode 100644 index 000000000..c44b45810 --- /dev/null +++ b/src/Bundle/ChillMainBundle/Notification/FlagProviders/AccompanyingCourseNotificationFlagProvider.php @@ -0,0 +1,20 @@ + + */ + private array $notificationFlagProviders; + + public function __construct( + iterable $notificaitonFlagProviders, + ) { + $this->notificationFlagProviders = iterator_to_array($notificaitonFlagProviders); + } + + public function getAllNotificationFlagProviders(): array + { + return $this->notificationFlagProviders; + } + + public function getNotificationFlagProviderByLabel(string $label): ?NotificationFlagProviderInterface + { + foreach ($this->notificationFlagProviders as $provider) { + if ($provider->getLabel() == $label) { + return $provider; + } + } + + return null; + } +} diff --git a/src/Bundle/ChillMainBundle/config/services/notification.yaml b/src/Bundle/ChillMainBundle/config/services/notification.yaml index be3252003..82ab9b29e 100644 --- a/src/Bundle/ChillMainBundle/config/services/notification.yaml +++ b/src/Bundle/ChillMainBundle/config/services/notification.yaml @@ -12,6 +12,10 @@ services: arguments: $routeParameters: '%chill_main.notifications%' + Chill\MainBundle\Notification\NotificationFlagManager: + arguments: + $notificationFlagProviders: !tagged_iterator chill_main.notification_flag_provider + Chill\MainBundle\Notification\NotificationHandlerManager: arguments: $handlers: !tagged_iterator chill_main.notification_handler