diff --git a/Parser/FormTypeParser.php b/Parser/FormTypeParser.php index dadc16b..4501902 100644 --- a/Parser/FormTypeParser.php +++ b/Parser/FormTypeParser.php @@ -56,7 +56,11 @@ class FormTypeParser $parameters = array(); 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 = ''; foreach ($childBuilder->getTypes() as $type) { diff --git a/Tests/Fixtures/Form/TestType.php b/Tests/Fixtures/Form/TestType.php index a6a1b08..004e4e9 100644 --- a/Tests/Fixtures/Form/TestType.php +++ b/Tests/Fixtures/Form/TestType.php @@ -23,6 +23,7 @@ class TestType extends AbstractType { $builder->add('a', null, array('description' => 'A nice description')); $builder->add('b'); + $builder->add($builder->create('c', 'checkbox')); } /** diff --git a/Tests/Fixtures/Model/Test.php b/Tests/Fixtures/Model/Test.php index 96992b8..4ee1dfd 100644 --- a/Tests/Fixtures/Model/Test.php +++ b/Tests/Fixtures/Model/Test.php @@ -24,4 +24,6 @@ class Test * @Assert\Type("DateTime"); */ public $b; + + public $c; } diff --git a/Tests/Formatter/MarkdownFormatterTest.php b/Tests/Formatter/MarkdownFormatterTest.php index 33b3157..a2ae4f3 100644 --- a/Tests/Formatter/MarkdownFormatterTest.php +++ b/Tests/Formatter/MarkdownFormatterTest.php @@ -75,6 +75,11 @@ b: * type: string * required: true +c: + + * type: boolean + * required: true + ### `POST` /tests ### @@ -93,6 +98,11 @@ b: * type: string * required: true +c: + + * type: boolean + * required: true + # others # diff --git a/Tests/Formatter/SimpleFormatterTest.php b/Tests/Formatter/SimpleFormatterTest.php index 0780255..73d4ffa 100644 --- a/Tests/Formatter/SimpleFormatterTest.php +++ b/Tests/Formatter/SimpleFormatterTest.php @@ -97,6 +97,12 @@ class SimpleFormatterTest extends WebTestCase 'required' => true, 'description' => '', ), + 'c' => + array( + 'dataType' => 'boolean', + 'required' => true, + 'description' => '', + ), ), 'description' => 'create test', ), @@ -121,6 +127,12 @@ class SimpleFormatterTest extends WebTestCase 'required' => true, 'description' => '', ), + 'c' => + array( + 'dataType' => 'boolean', + 'required' => true, + 'description' => '', + ), ), 'description' => 'create test', ),