do not persist if no notification is scheduled

This commit is contained in:
Julien Fastré 2022-04-22 12:31:23 +02:00
parent 354f130e9e
commit 19561c63cb

View File

@ -46,6 +46,7 @@ class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberIn
private function persistNotifications(): void private function persistNotifications(): void
{ {
if (0 < count($this->persister->getWaitingNotifications())) {
foreach ($this->persister->getWaitingNotifications() as $notification) { foreach ($this->persister->getWaitingNotifications() as $notification) {
$this->em->persist($notification); $this->em->persist($notification);
} }
@ -53,3 +54,4 @@ class PersistNotificationOnTerminateEventSubscriber implements EventSubscriberIn
$this->em->flush(); $this->em->flush();
} }
} }
}