I'd like to know weather is possible and how to configure a filter for the list view as the following with SonataAdminBundle in Symfony 2
Say I have entities Order, pointing to entities User, pointing to entities Company. I want to configure filters both for filtering by User and also for filtering by Company (User's Company) The first is straight forward. The second is what I try to clearify.
In the class OrderAdmin I would overwrite configureDatagridFilters as:
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('created_at')
//... some other filters on Order fields, as usual
// the filter on User, provided 'user', no ploblem
->add('user')
// and the filter by Company
->add('user.company') // this doesn't work, of course
;
}
That syntax for the company filter is inpired by sonta docs: http://sonata-project.org/bundles/doctrine-orm-admin/2-0/doc/reference/filter_field_definition.html
Is not intended for what I try to acomplish, but cannot find where to look at.
Hope someone has a clue on this.
Thanks