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;
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(),

View File

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