Fallback to text when no type is present

This commit is contained in:
Jordi Boggiano 2012-04-13 14:12:29 +02:00
parent 15d56360f3
commit 12f65fed4f

View File

@ -56,10 +56,10 @@ class FormTypeParser
$parameters = array();
foreach ($builder->all() as $name => $child) {
$b = $builder->create($name, $child['type'], $child['options']);
$childBuilder = $builder->create($name, $child['type'] ?: 'text', $child['options']);
$bestType = '';
foreach ($b->getTypes() as $type) {
foreach ($childBuilder->getTypes() as $type) {
if (isset($this->mapTypes[$type->getName()])) {
$bestType = $this->mapTypes[$type->getName()];
}
@ -67,8 +67,8 @@ class FormTypeParser
$parameters[$name] = array(
'dataType' => $bestType,
'required' => $b->getRequired(),
'description' => $b->getAttribute('description'),
'required' => $childBuilder->getRequired(),
'description' => $childBuilder->getAttribute('description'),
);
}