diff --git a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php index 9c657ae46..d3112fd97 100644 --- a/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php +++ b/src/Bundle/ChillMainBundle/CRUD/Controller/CRUDController.php @@ -342,13 +342,19 @@ class CRUDController extends AbstractController */ protected function buildQueryEntities(string $action, Request $request) { - return $this->getDoctrine()->getManager() + $query = $this->getDoctrine()->getManager() ->createQueryBuilder() ->select('e') ->from($this->getEntityClass(), 'e') ; + + $this->customizeQuery($action, $request, $query); + + return $query; } + protected function customizeQuery(string $action, Request $request, $query): void {} + /** * Query the entity. * diff --git a/src/Bundle/ChillMainBundle/Controller/LocationController.php b/src/Bundle/ChillMainBundle/Controller/LocationController.php index e6aba8fc3..dc59db9b1 100644 --- a/src/Bundle/ChillMainBundle/Controller/LocationController.php +++ b/src/Bundle/ChillMainBundle/Controller/LocationController.php @@ -7,14 +7,14 @@ use Symfony\Component\HttpFoundation\Request; class LocationController extends CRUDController { - public function customizeQuery(string $action, Request $request, $query): void + protected function customizeQuery(string $action, Request $request, $query): void { //$query->where('e.availableforusers', "'TRUE'"); // not working $query->where('e.availableForUsers = true'); //TODO not working } - - public function createEntity(string $action, Request $request): object + + protected function createEntity(string $action, Request $request): object { $entity = parent::createEntity($action, $request); @@ -22,4 +22,4 @@ class LocationController extends CRUDController return $entity; } -} \ No newline at end of file +}