Merge pull request #122 from fvilpoix/80_default_string_field

#80 - unrecognized parameters type from form are defaultly set to 'string'
This commit is contained in:
William DURAND 2013-03-17 16:45:23 +01:00
commit c8a0115040

View File

@ -103,10 +103,20 @@ class FormTypeParser implements ParserInterface
* This is just a temporary workaround for don't breaking docs page in case of unsupported types * This is just a temporary workaround for don't breaking docs page in case of unsupported types
* like the entity type https://github.com/nelmio/NelmioApiDocBundle/issues/94 * like the entity type https://github.com/nelmio/NelmioApiDocBundle/issues/94
*/ */
$addDefault = false;
try { try {
$subForm = $this->formFactory->create($type); $subForm = $this->formFactory->create($type);
$parameters = array_merge($parameters, $this->parseForm($subForm, $name)); $subParameters = $this->parseForm($subForm, $name);
if (!empty($subParameters)) {
$parameters = array_merge($parameters, $subParameters);
} else {
$addDefault = true;
}
} catch (\Exception $e) { } catch (\Exception $e) {
$addDefault = true;
}
if ($addDefault) {
$parameters[$name] = array( $parameters[$name] = array(
'dataType' => 'string', 'dataType' => 'string',
'required' => $config->getRequired(), 'required' => $config->getRequired(),