18
18
use Ibexa \Bundle \AdminUi \Form \Type \SearchType ;
19
19
use Ibexa \Contracts \AdminUi \Controller \Controller ;
20
20
use Ibexa \Contracts \Core \Repository \NotificationService ;
21
+ use Ibexa \Contracts \Core \Repository \Values \Notification \Notification ;
21
22
use Ibexa \Contracts \Core \Repository \Values \Notification \Query \Criterion ;
22
- use Ibexa \Contracts \Core \Repository \Values \Notification \Query \Criterion \ NotificationQuery ;
23
+ use Ibexa \Contracts \Core \Repository \Values \Notification \Query \NotificationQuery ;
23
24
use Ibexa \Contracts \Core \SiteAccess \ConfigResolverInterface ;
24
25
use Ibexa \Core \Notification \Renderer \Registry ;
25
26
use InvalidArgumentException ;
@@ -93,7 +94,7 @@ public function renderNotificationsPageAction(Request $request, int $page): Resp
93
94
$ searchForm ->handleRequest ($ request );
94
95
95
96
$ query = new NotificationQuery ();
96
- if ($ searchForm ->isSubmitted () && $ searchForm ->isValid ()) {
97
+ if ($ searchForm ->isSubmitted () && $ searchForm ->isValid () && $ searchForm -> getData () instanceof SearchQueryData ) {
97
98
$ query = $ this ->buildQuery ($ searchForm ->getData ());
98
99
}
99
100
@@ -162,12 +163,15 @@ private function buildQuery(SearchQueryData $data): NotificationQuery
162
163
return new NotificationQuery ($ criteria );
163
164
}
164
165
166
+ /**
167
+ * @param Pagerfanta<\Ibexa\Contracts\Core\Repository\Values\Notification\Notification> $pagerfanta
168
+ */
165
169
private function createNotificationSelectionData (Pagerfanta $ pagerfanta ): NotificationSelectionData
166
170
{
167
171
$ notifications = [];
168
172
169
173
foreach ($ pagerfanta ->getCurrentPageResults () as $ notification ) {
170
- $ notifications [$ notification -> id ] = false ;
174
+ $ notifications [] = $ notification ;
171
175
}
172
176
173
177
return new NotificationSelectionData ($ notifications );
@@ -200,7 +204,7 @@ public function countNotificationsAction(): JsonResponse
200
204
* server service for websocket connection), so * we need a way to mark notification
201
205
* as read. AJAX call is fine.
202
206
*/
203
- public function markNotificationAsReadAction (Request $ request , mixed $ notificationId ): JsonResponse
207
+ public function markNotificationAsReadAction (Request $ request , $ notificationId ): JsonResponse
204
208
{
205
209
$ response = new JsonResponse ();
206
210
@@ -283,7 +287,7 @@ public function markAllNotificationsAsReadAction(Request $request): JsonResponse
283
287
}
284
288
}
285
289
286
- public function markNotificationAsUnreadAction (Request $ request , mixed $ notificationId ): JsonResponse
290
+ public function markNotificationAsUnreadAction (Request $ request , $ notificationId ): JsonResponse
287
291
{
288
292
$ response = new JsonResponse ();
289
293
@@ -307,7 +311,7 @@ public function markNotificationAsUnreadAction(Request $request, mixed $notifica
307
311
return $ response ;
308
312
}
309
313
310
- public function deleteNotificationAction (Request $ request , mixed $ notificationId ): JsonResponse
314
+ public function deleteNotificationAction (Request $ request , $ notificationId ): JsonResponse
311
315
{
312
316
$ response = new JsonResponse ();
313
317
0 commit comments