From d93235902486772063cc8e35c2df06b5740eec35 Mon Sep 17 00:00:00 2001 From: matthieu Date: Sun, 15 Mar 2026 19:45:58 +0100 Subject: [PATCH] feat(notification) : add NotificationProvider filtered by current user --- src/State/NotificationProvider.php | 33 ++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 src/State/NotificationProvider.php diff --git a/src/State/NotificationProvider.php b/src/State/NotificationProvider.php new file mode 100644 index 0000000..0a1b8b9 --- /dev/null +++ b/src/State/NotificationProvider.php @@ -0,0 +1,33 @@ + + */ +final readonly class NotificationProvider implements ProviderInterface +{ + public function __construct( + private Security $security, + private NotificationRepository $notificationRepository, + ) {} + + public function provide(Operation $operation, array $uriVariables = [], array $context = []): array|object + { + $user = $this->security->getUser(); + + return $this->notificationRepository->findBy( + ['user' => $user], + ['createdAt' => 'DESC'], + 30, + ); + } +}