From 0affc534c51eee3411c1715cc030ffa1724d9473 Mon Sep 17 00:00:00 2001 From: Tchama Date: Tue, 8 Sep 2020 18:26:37 +0200 Subject: [PATCH] inject PaginatorFactory in constructor --- Controller/ReportController.php | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/Controller/ReportController.php b/Controller/ReportController.php index b1075a146..2c9a7f4bd 100644 --- a/Controller/ReportController.php +++ b/Controller/ReportController.php @@ -21,6 +21,7 @@ namespace Chill\ReportBundle\Controller; +use Chill\MainBundle\Pagination\PaginatorFactory; use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Chill\PersonBundle\Privacy\PrivacyEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; @@ -51,16 +52,27 @@ class ReportController extends Controller */ protected $authorizationHelper; + /** + * @var PaginatorFactory + */ + protected $paginator; + /** * ReportController constructor. * * @param EventDispatcherInterface $eventDispatcher * @param AuthorizationHelper $authorizationHelper + * @param PaginatorFactory $paginator */ - public function __construct(EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper) + public function __construct( + EventDispatcherInterface $eventDispatcher, + AuthorizationHelper $authorizationHelper, + PaginatorFactory $paginator + ) { $this->eventDispatcher = $eventDispatcher; $this->authorizationHelper = $authorizationHelper; + $this->paginator = $paginator; } @@ -91,7 +103,7 @@ class ReportController extends Controller ->getSingleScalarResult(); // get the PaginatorFactory - $paginator = $this->get('chill_main.paginator_factory')->create($total); + $paginator = $this->paginator->create($total); $reports = $em->createQuery('SELECT r FROM ChillReportBundle:Report r