From 12f65fed4fb354f8a4a061c44e14b42fc9a0e1d8 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Fri, 13 Apr 2012 14:12:29 +0200 Subject: [PATCH] Fallback to text when no type is present --- Parser/FormTypeParser.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Parser/FormTypeParser.php b/Parser/FormTypeParser.php index 643bd9f..dadc16b 100644 --- a/Parser/FormTypeParser.php +++ b/Parser/FormTypeParser.php @@ -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'), ); }