2015-06-23 11:20:21 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Skobkin\Bundle\PointToolsBundle\Controller;
|
|
|
|
|
2019-01-18 23:20:58 +00:00
|
|
|
use Knp\Component\Pager\PaginatorInterface;
|
2017-11-05 01:42:08 +00:00
|
|
|
use Skobkin\Bundle\PointToolsBundle\Repository\SubscriptionEventRepository;
|
2017-11-05 02:03:26 +00:00
|
|
|
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
|
2017-11-05 01:42:08 +00:00
|
|
|
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
|
|
|
{
|
2019-01-18 23:20:58 +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(
|
2017-11-05 01:42:08 +00:00
|
|
|
$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
|
|
|
]);
|
|
|
|
}
|
|
|
|
}
|