Is there a way to create a custom filter type for SonataAdminBundle, that extends another type, for example the type doctrine_orm_callback? The idea is for re-use the custom type in other filters
public function configureDatagridFilters(DatagridMapper $datagridMapper)
{
$datagridMapper
->add('field', 'doctrine_orm_callback', array(
'callback' => function($queryBuilder, $alias, $field, $value) {
if (!$value['value']) {
return;
}
$queryBuilder->leftJoin(sprintf('%s.field', $alias), 'field')
->andWhere("field LIKE :field")
->setParameter('field', "%{$value['value']}%");
return true;
},
'field_type' => 'search'), null, array('pattern' => '^[A-Za-z0-9]{1,12}$'));
}
Thanks!