mirror of
https://github.com/retailcrm/NelmioApiDocBundle.git
synced 2025-02-02 15:51:48 +03:00
Fixed the parsing of formed defined by creating the FormBuilder directly
This commit is contained in:
parent
22dc9ae0c0
commit
378f21ec10
@ -56,7 +56,11 @@ class FormTypeParser
|
|||||||
|
|
||||||
$parameters = array();
|
$parameters = array();
|
||||||
foreach ($builder->all() as $name => $child) {
|
foreach ($builder->all() as $name => $child) {
|
||||||
$childBuilder = $builder->create($name, $child['type'] ?: 'text', $child['options']);
|
if ($child instanceof FormBuilder) {
|
||||||
|
$childBuilder = $child;
|
||||||
|
} else {
|
||||||
|
$childBuilder = $builder->create($name, $child['type'] ?: 'text', $child['options']);
|
||||||
|
}
|
||||||
|
|
||||||
$bestType = '';
|
$bestType = '';
|
||||||
foreach ($childBuilder->getTypes() as $type) {
|
foreach ($childBuilder->getTypes() as $type) {
|
||||||
|
@ -23,6 +23,7 @@ class TestType extends AbstractType
|
|||||||
{
|
{
|
||||||
$builder->add('a', null, array('description' => 'A nice description'));
|
$builder->add('a', null, array('description' => 'A nice description'));
|
||||||
$builder->add('b');
|
$builder->add('b');
|
||||||
|
$builder->add($builder->create('c', 'checkbox'));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,4 +24,6 @@ class Test
|
|||||||
* @Assert\Type("DateTime");
|
* @Assert\Type("DateTime");
|
||||||
*/
|
*/
|
||||||
public $b;
|
public $b;
|
||||||
|
|
||||||
|
public $c;
|
||||||
}
|
}
|
||||||
|
@ -75,6 +75,11 @@ b:
|
|||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
|
||||||
|
c:
|
||||||
|
|
||||||
|
* type: boolean
|
||||||
|
* required: true
|
||||||
|
|
||||||
|
|
||||||
### `POST` /tests ###
|
### `POST` /tests ###
|
||||||
|
|
||||||
@ -93,6 +98,11 @@ b:
|
|||||||
* type: string
|
* type: string
|
||||||
* required: true
|
* required: true
|
||||||
|
|
||||||
|
c:
|
||||||
|
|
||||||
|
* type: boolean
|
||||||
|
* required: true
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# others #
|
# others #
|
||||||
|
@ -97,6 +97,12 @@ class SimpleFormatterTest extends WebTestCase
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'description' => '',
|
'description' => '',
|
||||||
),
|
),
|
||||||
|
'c' =>
|
||||||
|
array(
|
||||||
|
'dataType' => 'boolean',
|
||||||
|
'required' => true,
|
||||||
|
'description' => '',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'description' => 'create test',
|
'description' => 'create test',
|
||||||
),
|
),
|
||||||
@ -121,6 +127,12 @@ class SimpleFormatterTest extends WebTestCase
|
|||||||
'required' => true,
|
'required' => true,
|
||||||
'description' => '',
|
'description' => '',
|
||||||
),
|
),
|
||||||
|
'c' =>
|
||||||
|
array(
|
||||||
|
'dataType' => 'boolean',
|
||||||
|
'required' => true,
|
||||||
|
'description' => '',
|
||||||
|
),
|
||||||
),
|
),
|
||||||
'description' => 'create test',
|
'description' => 'create test',
|
||||||
),
|
),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user