EasyAdmin 3 : Filter for property of a propert

Viewed 1294

I have 3 Entities : Country, Region, City A region has a country property, and the city had a region property. In the city crud controller, I'd like to add a filter by country. I try to do

return $filters
        ->add('region.country')

But I have this error : Call to a member function getAsDto() on array

And I also try to add a getCountry in my City entity, which return region.getCountry value, and then do

return $filters
        ->add(EntityFilter::new('country'))

But I have this error : An error has occurred resolving the options of the form "Symfony\Bridge\Doctrine\Form\Type\EntityType": The required option "class" is missing.

Is there a simple way to do a filter on a parent of an object in my entity ?

1 Answers

Have you tried:

        ->add(EntityFilter::new('country')->mapped(false))

?

Related