-3

I have 2 entities, User and Mairie that extends User. In my UserCrudController, the index page displays both child and parent entities. I only want the parent entities, How can I do ? Thank you in advance, Renaud

1 Answers1

0

I found a solution with the GitHub community.

I've use a special ROLE to show desired entities with the Inlor's code shared in the link below.

public function createIndexQueryBuilder(SearchDto $searchDto, EntityDto $entityDto, FieldCollection $fields, FilterCollection $filters): QueryBuilder 
{ 
$response = parent::createIndexQueryBuilder($searchDto, $entityDto, $fields, $filters); 
$response->where("entity.roles LIKE '%%ROLE_WANTED%%'"); 
return $response; 
}

https://github.com/EasyCorp/EasyAdminBundle/issues/4370

Dharman
  • 30,962
  • 25
  • 85
  • 135