Loading module/Oscar/src/Oscar/Entity/NotificationRepository.php +8 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,14 @@ class NotificationRepository extends EntityRepository return $qb->getQuery()->execute(); } public function removeNotificationsActivity(int $activityId) { foreach ($this->getNotificationsActivity($activityId) as $notification) { $this->getEntityManager()->remove($notification); } $this->getEntityManager()->flush(); } public function purgeAll() { $dql = 'DELETE ' . Notification::class; Loading module/Oscar/src/Oscar/Service/NotificationService.php +11 −0 Original line number Diff line number Diff line Loading @@ -862,6 +862,17 @@ class NotificationService implements UseServiceContainer return $this->getNotificationRepository()->deleteNotificationsPerson($person->getId()); } public function deleteNotificationActivityById(int $activityId) { try { $this->getNotificationRepository()->removeNotificationsActivity($activityId); } catch (\Exception $e) { $this->getLoggerService()->err("Suppression des notifications pour l'activité '$activityId' : " . $e->getMessage()); } } /** * @param $personId * @return array Loading Loading
module/Oscar/src/Oscar/Entity/NotificationRepository.php +8 −0 Original line number Diff line number Diff line Loading @@ -121,6 +121,14 @@ class NotificationRepository extends EntityRepository return $qb->getQuery()->execute(); } public function removeNotificationsActivity(int $activityId) { foreach ($this->getNotificationsActivity($activityId) as $notification) { $this->getEntityManager()->remove($notification); } $this->getEntityManager()->flush(); } public function purgeAll() { $dql = 'DELETE ' . Notification::class; Loading
module/Oscar/src/Oscar/Service/NotificationService.php +11 −0 Original line number Diff line number Diff line Loading @@ -862,6 +862,17 @@ class NotificationService implements UseServiceContainer return $this->getNotificationRepository()->deleteNotificationsPerson($person->getId()); } public function deleteNotificationActivityById(int $activityId) { try { $this->getNotificationRepository()->removeNotificationsActivity($activityId); } catch (\Exception $e) { $this->getLoggerService()->err("Suppression des notifications pour l'activité '$activityId' : " . $e->getMessage()); } } /** * @param $personId * @return array Loading