Three easy steps
1) configure function
Add an input for each field you want to include in your filter
Copy codeThe Code is as follows:
$ This-> widgetSchema ['name'] = new sfWidgetFormFilterInput (array ('with _ empty' => false ));
$ This-> validatorSchema ['name'] = new sfValidatorPass (array ('required' => false ));
2) add a query modification when filtering for that field
I 've done it for Doctrine. Pay atention to the method name addFIELDColumnQuery.
Copy codeThe Code is as follows:
Public function addNameColumnQuery (Doctrine_Query $ query, $ field, $ values)
{
If (is_array ($ values) & isset ($ values ['text']) & ''! = $ Values ['text'])
{
$ Query-> leftJoin ('R. Translation t ')
//-> AndWhere ('t. lang =? ', $ Especify_one_language) // or it will search in all of them
-> AndWhere ('concat (t. name, t. shortname) like? ',' % '. $ Values ['text'].' % ');
}
}
3) Add your searching fields
Copy codeThe Code is as follows:
Public function getFields ()
{
Return parent: getFields () + array ('name' => 'text ');
}
From: http://oldforum.symfony-project.org/index.php/t/24350/