point-tools/src/Controller/EventsController.php

26 lines
810 B
PHP
Raw Normal View History

2015-06-23 11:20:21 +00:00
<?php
declare(strict_types=1);
2015-06-23 11:20:21 +00:00
namespace App\Controller;
2015-06-23 11:20:21 +00:00
use Knp\Component\Pager\PaginatorInterface;
use App\Repository\SubscriptionEventRepository;
2017-11-05 02:03:26 +00:00
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\{Request, Response};
2015-06-23 11:20:21 +00:00
2017-11-05 02:03:26 +00:00
class EventsController extends AbstractController
2015-06-23 11:20:21 +00:00
{
public function lastAction(Request $request, SubscriptionEventRepository $eventRepository, PaginatorInterface $paginator): Response
2015-06-23 11:20:21 +00:00
{
2016-12-10 23:55:28 +00:00
$eventsPagination = $paginator->paginate(
$eventRepository->createLastSubscriptionEventsQuery(),
2016-12-10 23:55:28 +00:00
$request->query->getInt('page', 1),
20
);
2015-06-23 11:20:21 +00:00
return $this->render('SkobkinPointToolsBundle:Events:last.html.twig', [
2016-12-10 23:55:28 +00:00
'last_events' => $eventsPagination,
2015-06-23 11:20:21 +00:00
]);
}
}