Merge remote-tracking branch 'origin/improve_location-fix-crud' into improve_location

merge...
This commit is contained in:
nobohan 2021-10-25 09:30:17 +02:00
commit c46065d9c5
2 changed files with 11 additions and 5 deletions

View File

@ -342,13 +342,19 @@ class CRUDController extends AbstractController
*/ */
protected function buildQueryEntities(string $action, Request $request) protected function buildQueryEntities(string $action, Request $request)
{ {
return $this->getDoctrine()->getManager() $query = $this->getDoctrine()->getManager()
->createQueryBuilder() ->createQueryBuilder()
->select('e') ->select('e')
->from($this->getEntityClass(), 'e') ->from($this->getEntityClass(), 'e')
; ;
$this->customizeQuery($action, $request, $query);
return $query;
} }
protected function customizeQuery(string $action, Request $request, $query): void {}
/** /**
* Query the entity. * Query the entity.
* *

View File

@ -7,14 +7,14 @@ use Symfony\Component\HttpFoundation\Request;
class LocationController extends CRUDController 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'"); // not working
$query->where('e.availableForUsers = true'); //TODO 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); $entity = parent::createEntity($action, $request);