How to add condition in AssociationField in Symfony EasyAdmin
Solution 1:
AssociationField has a method called setQueryBuilder
which help you modify the query.
In your case, your association field should look like:
AssociationField::new('chapters')
->setQueryBuilder(function ($queryBuilder) {
return $queryBuilder->andWhere(''); // your query
});
You could also use a repository and call its method but returning a query builder (and not the result) inside setQueryBuilder.