Mathieu Jaumotte 2021-02-04 22:39:06 +01:00
parent 1cf0e51e9a
commit 0a89b5fc26
2 changed files with 14 additions and 6 deletions

View File

@ -20,20 +20,20 @@
namespace Chill\MainBundle\CRUD\Controller; namespace Chill\MainBundle\CRUD\Controller;
use Doctrine\ORM\QueryBuilder;
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController; use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
use Symfony\Component\HttpFoundation\Request; use Symfony\Component\HttpFoundation\Request;
use Symfony\Component\HttpFoundation\Response; use Symfony\Component\HttpFoundation\Response;
use Doctrine\ORM\QueryBuilder;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Symfony\Component\Form\FormInterface; use Symfony\Component\Form\FormInterface;
use Symfony\Component\Translation\TranslatorInterface; use Symfony\Component\Translation\TranslatorInterface;
use Symfony\Component\Form\Extension\Core\Type\SubmitType; use Symfony\Component\Form\Extension\Core\Type\SubmitType;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
use Symfony\Component\Security\Core\Role\Role; use Symfony\Component\Security\Core\Role\Role;
use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\EventDispatcher\EventDispatcherInterface;
use Chill\MainBundle\CRUD\Resolver\Resolver; use Chill\MainBundle\CRUD\Resolver\Resolver;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm; use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm;
use Chill\MainBundle\Pagination\PaginatorFactory;
use Chill\MainBundle\Pagination\PaginatorInterface;
use Chill\MainBundle\Security\Authorization\AuthorizationHelper;
/** /**
* Class CRUDController * Class CRUDController
@ -42,6 +42,7 @@ use Chill\MainBundle\CRUD\Form\CRUDDeleteEntityForm;
*/ */
class CRUDController extends AbstractController class CRUDController extends AbstractController
{ {
/** /**
* The crud configuration * The crud configuration
* *
@ -239,6 +240,10 @@ class CRUDController extends AbstractController
return $response; return $response;
} }
if (!isset($entity)) {
$entity = '';
}
$response = $this->onPostCheckACL($action, $request, $entity); $response = $this->onPostCheckACL($action, $request, $entity);
if ($response instanceof Response) { if ($response instanceof Response) {
return $response; return $response;
@ -1101,6 +1106,8 @@ class CRUDController extends AbstractController
} }
/** /**
* Include services
*
* @param string $action * @param string $action
* @return mixed * @return mixed
*/ */
@ -1114,7 +1121,7 @@ class CRUDController extends AbstractController
*/ */
protected function getPaginatorFactory(): PaginatorFactory 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 * @return array
*/ */
public static function getSubscribedServices() public static function getSubscribedServices(): array
{ {
return \array_merge( return \array_merge(
parent::getSubscribedServices(), parent::getSubscribedServices(),

View File

@ -1,6 +1,7 @@
services: services:
chill_main.paginator_factory: chill_main.paginator_factory:
class: Chill\MainBundle\Pagination\PaginatorFactory class: Chill\MainBundle\Pagination\PaginatorFactory
public: true
arguments: arguments:
- "@request_stack" - "@request_stack"
- "@router" - "@router"