@@ -108,11 +108,27 @@ public function delete(INotification $notification): array {
108108		}
109109		$ statementcloseCursor ();
110110
111- 		foreach  ($ deletedas  $ user$ entries
112- 			foreach  ($ entriesas  $ entry
113- 				$ this deleteById ($ entry'id ' ], (string ) $ user$ notifications$ entry'id ' ]]);
111+ 		$ this connection ->beginTransaction ();
112+ 		try  {
113+ 			$ shouldFlush$ this manager ->defer ();
114+ 
115+ 			foreach  ($ notificationsas  $ n
116+ 				$ this manager ->dismissNotification ($ n
117+ 			}
118+ 
119+ 			$ notificationIdsarray_keys ($ notifications
120+ 			foreach  (array_chunk ($ notificationIds1000 ) as  $ chunk
121+ 				$ this deleteIds ($ chunk
114122			}
123+ 
124+ 			if  ($ shouldFlush
125+ 				$ this manager ->flush ();
126+ 			}
127+ 		} catch  (\Throwable   $ e
128+ 			$ this connection ->rollBack ();
129+ 			throw  $ e
115130		}
131+ 		$ this connection ->commit ();
116132
117133		return  $ deleted
118134	}
@@ -156,6 +172,18 @@ public function deleteById(int $id, string $user, ?INotification $notification =
156172		return  (bool ) $ sqlexecuteStatement ();
157173	}
158174
175+ 	/** 
176+ 	 * Delete the notification matching the given ids 
177+ 	 * 
178+ 	 * @param int[] $ids 
179+ 	 */ 
180+ 	public  function  deleteIds (array  $ idsvoid  {
181+ 		$ sql$ this connection ->getQueryBuilder ();
182+ 		$ sqldelete ('notifications ' )
183+ 			->where ($ sqlexpr ()->in ('notification_id ' , $ sqlcreateNamedParameter ($ idsPARAM_INT_ARRAY )));
184+ 		$ sqlexecuteStatement ();
185+ 	}
186+ 
159187	/** 
160188	 * Get the notification matching the given id 
161189	 * 
0 commit comments