[Form] Fixed empty value in choice fields

This commit is contained in:
Bernhard Schussek 2011-04-06 15:59:09 +02:00
parent e476231e8a
commit 3482ff73b7
2 changed files with 4 additions and 1 deletions

View File

@ -459,7 +459,6 @@ class Form implements \IteratorAggregate, FormInterface
}
}
// Merge form data from children into existing client data
if (count($this->children) > 0 && $this->dataMapper) {
$this->dataMapper->mapFormsToData($this->children, $clientData);

View File

@ -92,6 +92,9 @@ class ChoiceType extends AbstractType
public function getDefaultOptions(array $options)
{
$multiple = isset($options['multiple']) && $options['multiple'];
$expanded = isset($options['expanded']) && $options['expanded'];
return array(
'multiple' => false,
'expanded' => false,
@ -99,6 +102,7 @@ class ChoiceType extends AbstractType
'choices' => array(),
'preferred_choices' => array(),
'csrf_protection' => false,
'empty_data' => $multiple || $expanded ? array() : '',
);
}