OK I understood. Here is the solution:
protected function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
...
->add('town', null, array('label' => 'Town'), null, array(
'expanded' => true,
'multiple' => true,
'query_builder' => function (\Doctrine\ORM\EntityRepository $repository) {
return $repository->createQueryBuilder('t')
->where('t.id = ?1')
->setParameter(1, 1)
->add('orderBy', 't.name ASC');
}
))
...
;
}
source
share