2012-05-14 169 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

這幫助呢? –