default values not sets when sfWidgetFormSelectDoubleList using with sfWidgetFormDoctrineChoiceGrouped widgets.
If use sfWidgetFormDoctrineChoice all work.
public function configure() {
$this->setWidget('prices_on_page', new sfWidgetFormDoctrineChoiceGrouped(array(
'model' => 'Price',
'multiple' => true,
'order_by' => array('Position', 'asc'),
'group_by' => 'PriceFolder',
'renderer_class' => 'sfWidgetFormSelectDoubleList',
)));
$this->validatorSchema['prices_on_page'] = new sfValidatorDoctrineChoice(array(
'model' => 'Price',
'required' => false,
'multiple' => true,
));
}
public function updateDefaultsFromObject() {
if (isset($this->widgetSchema['prices_on_page'])) {
$values = array();
foreach ($this->object->getPricesOnPage() as $obj) {
$values[] = $obj->getPriceId();
}
$this->setDefault('prices_on_page', $values);
}
}