From 0be4dc00608108624e9c51f5574e0f92d2f4506a Mon Sep 17 00:00:00 2001 From: Xbird Date: Thu, 21 Jul 2022 13:08:18 +0000 Subject: [PATCH] Fix notification error --- package.json | 2 +- .../NotificationsSubscriber.php | 19 ++++++++++--------- 2 files changed, 11 insertions(+), 10 deletions(-) diff --git a/package.json b/package.json index 2a4b8ee..e4a8b76 100644 --- a/package.json +++ b/package.json @@ -1,3 +1,3 @@ { - "version": "0.2.3" + "version": "0.2.4" } diff --git a/src/EventSubscriber/NotificationsSubscriber.php b/src/EventSubscriber/NotificationsSubscriber.php index dd6523a..37fa1a5 100644 --- a/src/EventSubscriber/NotificationsSubscriber.php +++ b/src/EventSubscriber/NotificationsSubscriber.php @@ -2,6 +2,7 @@ namespace App\EventSubscriber; +use App\Entity\Notification; use App\Entity\User; use Twig\Environment; use Doctrine\ORM\EntityManagerInterface; @@ -42,7 +43,7 @@ class NotificationsSubscriber implements EventSubscriberInterface * @var NotificationRepository notificationRepo */ - if (null === ($notificationRepo = $this->entityManager->getRepository("App:Notification"))) { + if (null === ($notificationRepo = $this->entityManager->getRepository(Notification::class))) { return; } @@ -58,19 +59,19 @@ class NotificationsSubscriber implements EventSubscriberInterface $this->twig->addGlobal( 'user_notifications_list', $notificationRepo->listForUser($User) - ->readed(false) - ->limit(5) - ->order(['createdAt' => 'DESC']) - ->getResult() + ->readed(false) + ->limit(5) + ->order(['createdAt' => 'DESC']) + ->getResult() ); $this->twig->addGlobal( 'user_notifications_count', $notificationRepo->listForUser($User) - ->readed(false) - ->limit(5) - ->order(['createdAt' => 'DESC']) - ->getCount() + ->readed(false) + ->limit(5) + ->order(['createdAt' => 'DESC']) + ->getCount() ); }