Merge pull request #100 from alex88/patch-1

Exception handling on unsupported fields types
This commit is contained in:
Jordi Boggiano 2012-11-19 02:23:22 -08:00
commit 588e69ffd7

View File

@ -96,8 +96,22 @@ class FormTypeParser implements ParserInterface
if ('' === $bestType) { if ('' === $bestType) {
if ($type = $config->getType()) { if ($type = $config->getType()) {
if ($type = $type->getInnerType()) { if ($type = $type->getInnerType()) {
$subForm = $this->formFactory->create($type); /**
$parameters = array_merge($parameters, $this->parseForm($subForm, $name)); * TODO: Implement a better handling 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
*/
try {
$subForm = $this->formFactory->create($type);
$parameters = array_merge($parameters, $this->parseForm($subForm, $name));
} catch (\Exception $e) {
$parameters[$name] = array(
'dataType' => 'string',
'required' => $config->getRequired(),
'description' => $config->getAttribute('description'),
'readonly' => $config->getDisabled(),
);
}
continue; continue;
} }