diff --git a/Controller/EventController.php b/Controller/EventController.php index e9e0b10d6..fa0797ce9 100644 --- a/Controller/EventController.php +++ b/Controller/EventController.php @@ -24,6 +24,7 @@ namespace Chill\EventBundle\Controller; use Chill\EventBundle\Entity\Participation; use Chill\EventBundle\Form\Type\PickEventType; +use Chill\MainBundle\Pagination\PaginatorFactory; use PhpOffice\PhpSpreadsheet\Spreadsheet; use PhpOffice\PhpSpreadsheet\Writer\Csv; use PhpOffice\PhpSpreadsheet\Writer\Ods; @@ -77,6 +78,11 @@ class EventController extends Controller */ protected $translator; + /** + * @var PaginatorFactory + */ + protected $paginator; + /** * EventController constructor. * @@ -84,18 +90,21 @@ class EventController extends Controller * @param AuthorizationHelper $authorizationHelper * @param FormFactoryInterface $formFactoryInterface * @param TranslatorInterface $translator + * @param PaginatorFactory $paginator */ public function __construct( EventDispatcherInterface $eventDispatcher, AuthorizationHelper $authorizationHelper, FormFactoryInterface $formFactoryInterface, - TranslatorInterface $translator + TranslatorInterface $translator, + PaginatorFactory $paginator ) { $this->eventDispatcher = $eventDispatcher; $this->authorizationHelper = $authorizationHelper; $this->formFactoryInterface = $formFactoryInterface; $this->translator = $translator; + $this->paginator = $paginator; } @@ -388,11 +397,7 @@ class EventController extends Controller $total = $em->getRepository('ChillEventBundle:Participation')->countByPerson($person_id); - /** - * @var $paginatorFactory \Chill\MainBundle\Pagination\PaginatorFactory - */ - $paginatorFactory = $this->get('chill_main.paginator_factory'); - $paginator = $paginatorFactory->create($total); + $paginator = $this->paginator->create($total); $participations = $em->getRepository('ChillEventBundle:Participation')->findByPersonInCircle( $person_id, diff --git a/Controller/ParticipationController.php b/Controller/ParticipationController.php index b39f8387d..dda987c0a 100644 --- a/Controller/ParticipationController.php +++ b/Controller/ParticipationController.php @@ -369,7 +369,8 @@ class ParticipationController extends Controller . "the object manager using the method ".__METHOD__); } - $event_id = $request->query->getInt('event_id', null); + $event_id = $request->query->getInt('event_id', 0); // sf4 check: + // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` if ($event_id !== NULL) { $event = $em->getRepository('ChillEventBundle:Event') @@ -388,9 +389,9 @@ class ParticipationController extends Controller // this script should be able to handle multiple, so we translate // single person_id in an array $persons_ids = $request->query->has('person_id') ? - array($request->query->getInt('person_id', null)): - explode(',', $request->query->get('persons_ids')) - ; + [$request->query->getInt('person_id', 0)] // sf4 check: + // prevent error: `Argument 2 passed to ::getInt() must be of the type int, null given` + : explode(',', $request->query->get('persons_ids')); $participations = array(); foreach($persons_ids as $person_id) { diff --git a/config/services.yaml b/config/services.yaml index 0282f881a..8287f32b5 100644 --- a/config/services.yaml +++ b/config/services.yaml @@ -1,4 +1,2 @@ services: - Chill\EventBundle\: - resource: '../../*' - exclude: '../../{Entity,Resources/migrations,Resources/test}' + diff --git a/config/services/controller.yaml b/config/services/controller.yaml index a2e5e7a65..0c79dbe1c 100644 --- a/config/services/controller.yaml +++ b/config/services/controller.yaml @@ -6,5 +6,6 @@ services: $authorizationHelper: '@Chill\MainBundle\Security\Authorization\AuthorizationHelper' $formFactoryInterface: '@Symfony\Component\Form\FormFactoryInterface' $translator: '@Symfony\Component\Translation\TranslatorInterface' + $paginator: '@chill_main.paginator_factory' public: true