Merge branch 'issue220_fix_notification_event_error' into 'master'

Fix typing of doctrine events on Notification

Closes #220

See merge request Chill-Projet/chill-bundles!626
This commit is contained in:
Julien Fastré 2024-02-07 13:23:54 +00:00
commit 4df0542932
3 changed files with 14 additions and 2 deletions

View File

@ -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"

View File

@ -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());
}

View File

@ -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