diff --git a/CRUD/Controller/CRUDController.php b/CRUD/Controller/CRUDController.php index b3d8850ca..8a8d32932 100644 --- a/CRUD/Controller/CRUDController.php +++ b/CRUD/Controller/CRUDController.php @@ -20,20 +20,20 @@ namespace Chill\MainBundle\CRUD\Controller; +use Doctrine\ORM\QueryBuilder; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Response; -use Doctrine\ORM\QueryBuilder; -use Chill\MainBundle\Pagination\PaginatorFactory; use Symfony\Component\Form\FormInterface; use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Form\Extension\Core\Type\SubmitType; -use Chill\MainBundle\Security\Authorization\AuthorizationHelper; use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Chill\MainBundle\CRUD\Resolver\Resolver; -use Chill\MainBundle\Pagination\PaginatorInterface; use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm; +use Chill\MainBundle\Pagination\PaginatorFactory; +use Chill\MainBundle\Pagination\PaginatorInterface; +use Chill\MainBundle\Security\Authorization\AuthorizationHelper; /** * Class CRUDController @@ -42,6 +42,7 @@ use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm; */ class CRUDController extends AbstractController { + /** * The crud configuration * @@ -239,6 +240,10 @@ class CRUDController extends AbstractController return $response; } + if (!isset($entity)) { + $entity = ''; + } + $response = $this->onPostCheckACL($action, $request, $entity); if ($response instanceof Response) { return $response; @@ -1101,6 +1106,8 @@ class CRUDController extends AbstractController } /** + * Include services + * * @param string $action * @return mixed */ @@ -1114,7 +1121,7 @@ class CRUDController extends AbstractController */ protected function getPaginatorFactory(): PaginatorFactory { - return $this->get(PaginatorFactory::class); + return $this->container->get('chill_main.paginator_factory'); } /** @@ -1164,7 +1171,7 @@ class CRUDController extends AbstractController /** * @return array */ - public static function getSubscribedServices() + public static function getSubscribedServices(): array { return \array_merge( parent::getSubscribedServices(), diff --git a/config/services/pagination.yaml b/config/services/pagination.yaml index ca9b50e4f..c7c8a89a9 100644 --- a/config/services/pagination.yaml +++ b/config/services/pagination.yaml @@ -1,6 +1,7 @@ services: chill_main.paginator_factory: class: Chill\MainBundle\Pagination\PaginatorFactory + public: true arguments: - "@request_stack" - "@router"