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
Asked
Active
Viewed 558 times
1 Answers
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;
}

Dharman
- 30,962
- 25
- 85
- 135

MonsieurLambda
- 1
- 1