[Form] Fixed empty value in choice fields
This commit is contained in:
parent
e476231e8a
commit
3482ff73b7
@ -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);
|
||||
|
@ -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() : '',
|
||||
);
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user