mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-06-07 18:44:08 +00:00
Add a separate method for onPersist, use same private resetCache method
This commit is contained in:
parent
d58c0a867d
commit
32ae2f8f0d
@ -16,6 +16,7 @@ use Chill\MainBundle\Entity\NotificationComment;
|
||||
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;
|
||||
@ -62,6 +63,11 @@ final readonly class NotificationByUserCounter implements NotificationCounterInt
|
||||
return 'chill_main_notif_unread_by_'.$user->getId();
|
||||
}
|
||||
|
||||
public function onPersistNotificationComment(NotificationComment $notificationComment, PostPersistEventArgs $eventArgs): void
|
||||
{
|
||||
$this->resetCacheForNotification($notificationComment->getNotification());
|
||||
}
|
||||
|
||||
public function onEditNotificationComment(NotificationComment $notificationComment, PostUpdateEventArgs $eventArgs): void
|
||||
{
|
||||
$this->resetCacheForNotification($notificationComment->getNotification());
|
||||
|
@ -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
|
||||
|
Loading…
x
Reference in New Issue
Block a user