@@ -64,9 +64,7 @@ public function getNotificationsAction(Request $request, int $offset, int $limit
64
64
$ response = new JsonResponse ();
65
65
66
66
try {
67
- $ notificationList = $ this ->notificationService ->loadNotifications (
68
- new NotificationQuery ([], $ offset , $ limit )
69
- );
67
+ $ notificationList = $ this ->notificationService ->loadNotifications ($ offset , $ limit );
70
68
$ response ->setData ([
71
69
'pending ' => $ this ->notificationService ->getPendingNotificationCount (),
72
70
'total ' => $ notificationList ->totalCount ,
@@ -84,9 +82,7 @@ public function getNotificationsAction(Request $request, int $offset, int $limit
84
82
85
83
public function renderNotificationsPageAction (Request $ request , int $ page ): Response
86
84
{
87
- $ allNotifications = $ this ->notificationService ->loadNotifications (
88
- new NotificationQuery ([], 0 , PHP_INT_MAX )
89
- )->items ;
85
+ $ allNotifications = $ this ->notificationService ->loadNotifications (0 , PHP_INT_MAX )->items ;
90
86
91
87
$ notificationTypes = array_unique (array_column ($ allNotifications , 'type ' ));
92
88
sort ($ notificationTypes );
@@ -101,13 +97,13 @@ public function renderNotificationsPageAction(Request $request, int $page): Resp
101
97
$ query = $ this ->buildQuery ($ searchForm ->getData ());
102
98
}
103
99
104
- $ query ->offset = ( $ page - 1 ) * $ this ->configResolver ->getParameter ('pagination.notification_limit ' );
105
- $ query ->limit = $ this ->configResolver ->getParameter ('pagination.notification_limit ' );
100
+ $ query ->setOffset (( $ page - 1 ) * $ this ->configResolver ->getParameter ('pagination.notification_limit ' ) );
101
+ $ query ->setLimit ( $ this ->configResolver ->getParameter ('pagination.notification_limit ' ) );
106
102
107
103
$ pagerfanta = new Pagerfanta (
108
104
new NotificationAdapter ($ this ->notificationService , $ query )
109
105
);
110
- $ pagerfanta ->setMaxPerPage ($ query ->limit );
106
+ $ pagerfanta ->setMaxPerPage ($ query ->getLimit () );
111
107
$ pagerfanta ->setCurrentPage (min ($ page , $ pagerfanta ->getNbPages ()));
112
108
113
109
$ notifications = [];
@@ -272,9 +268,7 @@ public function markAllNotificationsAsReadAction(Request $request): JsonResponse
272
268
$ response = new JsonResponse ();
273
269
274
270
try {
275
- $ notifications = $ this ->notificationService ->loadNotifications (
276
- new NotificationQuery ([], 0 , PHP_INT_MAX )
277
- )->items ;
271
+ $ notifications = $ this ->notificationService ->loadNotifications (0 , PHP_INT_MAX )->items ;
278
272
279
273
foreach ($ notifications as $ notification ) {
280
274
$ this ->notificationService ->markNotificationAsRead ($ notification );
0 commit comments