Three easy steps
1) Configure function
Add an input for each field want to include in your filter
Copy the Code code 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 the Code code 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'll search in all of them
->andwhere (' CONCAT (T.name, t.shortname) like? ', '% '. $values [' text ']. '%');
}
}
3) Add Your searching fields
Copy the Code code as follows:
Public Function GetFields ()
{
return Parent::getfields () + array (' name ' = = ' Text ');
}
From:http://oldforum.symfony-project.org/index.php/t/24350/
The above describes the Filterchain Admin generator, filters and i18n, including the filterchain aspects of the content, I hope that the PHP tutorial interested in a friend helpful.