2012-05-14 213 views

回答

1

你总是可以本地化的选择,然后前面加上价值生成的数组,你想使用:

$choice = new sfWidgetFormDoctrineChoice(array('model' => 'MODEL', 'order_by' => array('name', 'asc'))); 

$choices = $choice->getChoices(); 

array_unshift($choices, array('key' => 'My Custom Value')); 

$this->widgetSchema['widget_name']  = new sfWidgetFormChoice(array('choices' => $choices)); 
$this->validatorSchema['widget_name'] = new sfValidatorChoice(array('choices' => array_keys($choices)); 
+0

这帮助呢? –