mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 23:59:26 +03:00
Fallback to text when no type is present
This commit is contained in:
parent
15d56360f3
commit
12f65fed4f
@ -56,10 +56,10 @@ class FormTypeParser
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
foreach ($builder->all() as $name => $child) {
|
foreach ($builder->all() as $name => $child) {
|
||||||
$b = $builder->create($name, $child['type'], $child['options']);
|
$childBuilder = $builder->create($name, $child['type'] ?: 'text', $child['options']);
|
||||||
|
|
||||||
$bestType = '';
|
$bestType = '';
|
||||||
foreach ($b->getTypes() as $type) {
|
foreach ($childBuilder->getTypes() as $type) {
|
||||||
if (isset($this->mapTypes[$type->getName()])) {
|
if (isset($this->mapTypes[$type->getName()])) {
|
||||||
$bestType = $this->mapTypes[$type->getName()];
|
$bestType = $this->mapTypes[$type->getName()];
|
||||||
}
|
}
|
||||||
@ -67,8 +67,8 @@ class FormTypeParser
|
|||||||
|
|
||||||
$parameters[$name] = array(
|
$parameters[$name] = array(
|
||||||
'dataType' => $bestType,
|
'dataType' => $bestType,
|
||||||
'required' => $b->getRequired(),
|
'required' => $childBuilder->getRequired(),
|
||||||
'description' => $b->getAttribute('description'),
|
'description' => $childBuilder->getAttribute('description'),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user