From c1ee7c67058d909e08f05e56346fe0d416019a1f Mon Sep 17 00:00:00 2001 From: fvilpoix Date: Wed, 26 Dec 2012 11:21:30 +0100 Subject: [PATCH] #80 - unrecognized parameters type from form are defaultly set to 'string' --- Parser/FormTypeParser.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/Parser/FormTypeParser.php b/Parser/FormTypeParser.php index 25a73bd..9377d21 100644 --- a/Parser/FormTypeParser.php +++ b/Parser/FormTypeParser.php @@ -101,10 +101,20 @@ class FormTypeParser implements ParserInterface * 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 */ + $addDefault = false; try { $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) { + $addDefault = true; + } + + if ($addDefault) { $parameters[$name] = array( 'dataType' => 'string', 'required' => $config->getRequired(),