diff --git a/.changes/unreleased/Fixed-20231129-113138.yaml b/.changes/unreleased/Fixed-20231129-113138.yaml new file mode 100644 index 000000000..efe9b10c1 --- /dev/null +++ b/.changes/unreleased/Fixed-20231129-113138.yaml @@ -0,0 +1,6 @@ +kind: Fixed +body: Fix error in logs about wrong typing of eventArgs in onEditNotificationComment + method +time: 2023-11-29T11:31:38.933538592+01:00 +custom: + Issue: "220" diff --git a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php index 81a8bb3bb..e08543e8c 100644 --- a/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php +++ b/src/Bundle/ChillMainBundle/Notification/Counter/NotificationByUserCounter.php @@ -17,6 +17,7 @@ use Chill\MainBundle\Entity\User; use Chill\MainBundle\Repository\NotificationRepository; use Chill\MainBundle\Templating\UI\NotificationCounterInterface; use Doctrine\ORM\Event\PostPersistEventArgs; +use Doctrine\ORM\Event\PostUpdateEventArgs; use Doctrine\ORM\Event\PreFlushEventArgs; use Psr\Cache\CacheItemPoolInterface; use Symfony\Component\Security\Core\User\UserInterface; @@ -62,7 +63,12 @@ final readonly class NotificationByUserCounter implements NotificationCounterInt return 'chill_main_notif_unread_by_'.$user->getId(); } - public function onEditNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void + public function onPersistNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void + { + $this->resetCacheForNotification($notificationComment->getNotification()); + } + + public function onEditNotificationComment(NotificationComment $notificationComment, PostUpdateEventArgs $eventArgs): void { $this->resetCacheForNotification($notificationComment->getNotification()); } diff --git a/src/Bundle/ChillMainBundle/config/services/notification.yaml b/src/Bundle/ChillMainBundle/config/services/notification.yaml index 29cbce946..be3252003 100644 --- a/src/Bundle/ChillMainBundle/config/services/notification.yaml +++ b/src/Bundle/ChillMainBundle/config/services/notification.yaml @@ -41,7 +41,7 @@ services: entity: 'Chill\MainBundle\Entity\NotificationComment' # set the 'lazy' option to TRUE to only instantiate listeners when they are used lazy: true - method: 'onEditNotificationComment' + method: 'onPersistNotificationComment' Chill\MainBundle\Notification\Email\NotificationMailer: autowire: true