Skip to content

Latest commit

 

History

History
executable file
·
35 lines (27 loc) · 926 Bytes

chapter-11.md

File metadata and controls

executable file
·
35 lines (27 loc) · 926 Bytes

Configurable QueryBuilder

The AdminController create a query builder from the entity. This extension make possible to use your own query_builder defined in your repository without the need to override the controller.

Settings

To enable batch actions, you've to add a new node (batchs) for the action list of the entity.

# config/packages/easy_admin.yaml
easy_admin:
    entities:
        Ressource:
            class: App\Entity\Ressource
            qb_method: findActiveRessourceQb
            disabled_actions: [new]
            role: ROLE_RESSOURCE

The method should return a Qb and MUST use "entity" for the main alias.

    public function findActiveRessourceQb()
    {

        $qb = $this->createQueryBuilder('entity')
            ->join('entity.service','service')
            ->where('service.actif = 1')
        ;
        return $qb;
    }

Back to main readme