RVRNEXT-22 use the new repository methods in controllers
rvr-nextgen/pipeline/pr-master This commit looks good

This commit is contained in:
bence committed 2023-05-28 20:34:07 +02:00
1 parent 9929e00a3f
commit d1c926541a
2 files changed
+7 -9

No files matched your search

+3 -4
View File
@@ -68,17 +68,16 @@ class EventController implements IAuthenticationRequired, ISecured
{
$itemsPerPage = 10;
$numberOfEvents = $this->eventRepository->countAllByCommunity($this->community);
$pages = ceil($numberOfEvents / $itemsPerPage);
$currentPage = Container::$request->query('page') ?: 0;
$currentPage = Container::$request->query('page') ?: 1;
$events = $this->eventRepository->getPagedByCommunity(
$this->community,
$currentPage * $itemsPerPage,
$currentPage,
$itemsPerPage
);
return new HtmlContent('events/events', [
'community' => $this->community,
'pages' => $pages,
'pages' => ceil($numberOfEvents / $itemsPerPage),
'currentPage' => $currentPage,
'numberOfEvents' => $numberOfEvents,
'events' => $events