diff --git a/DependencyInjection/RegisterExtractorParsersPass.php b/DependencyInjection/RegisterExtractorParsersPass.php
index abf8fca..f9d4564 100644
--- a/DependencyInjection/RegisterExtractorParsersPass.php
+++ b/DependencyInjection/RegisterExtractorParsersPass.php
@@ -18,9 +18,11 @@ class RegisterExtractorParsersPass implements CompilerPassInterface
//find registered parsers and sort by priority
$sortedParsers = array();
- foreach ($container->findTaggedServiceIds('nelmio_api_doc.extractor.parser') as $id => $attributes) {
- $priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
- $sortedParsers[$priority][] = $id;
+ foreach ($container->findTaggedServiceIds('nelmio_api_doc.extractor.parser') as $id => $tagAttributes) {
+ foreach ($tagAttributes as $attributes) {
+ $priority = isset($attributes['priority']) ? $attributes['priority'] : 0;
+ $sortedParsers[$priority][] = $id;
+ }
}
//add parsers if any
diff --git a/Parser/FormTypeParser.php b/Parser/FormTypeParser.php
index af3bfac..2bce09b 100644
--- a/Parser/FormTypeParser.php
+++ b/Parser/FormTypeParser.php
@@ -83,7 +83,7 @@ class FormTypeParser implements ParserInterface
'dataType' => $bestType,
'required' => $config->getRequired(),
'description' => $config->getAttribute('description'),
- 'readonly' => false,
+ 'readonly' => $config->getDisabled(),
);
}
diff --git a/README.md b/README.md
index 56772e9..ae19234 100644
--- a/README.md
+++ b/README.md
@@ -82,7 +82,7 @@ class YourController extends Controller
/**
* @ApiDoc(
* description="Create a new Object",
- * formType="Your\Namespace\Form\Type\YourType"
+ * input="Your\Namespace\Form\Type\YourType"
* )
*/
public function postAction()
@@ -99,16 +99,16 @@ The following properties are available:
* `filters`: an array of filters;
-* `formType`: the Form Type associated to the method, useful for POST|PUT methods, either as FQCN or
+* `input`: the input type associated to the method, currently this only supports Form Types, useful for POST|PUT methods, either as FQCN or
as form type (if it is registered in the form factory in the container)
Each _filter_ has to define a `name` parameter, but other parameters are free. Filters are often optional
parameters, and you can document them as you want, but keep in mind to be consistent for the whole documentation.
-If you set a `formType`, then the bundle automatically extracts parameters based on the given type,
+If you set `input`, then the bundle automatically extracts parameters based on the given type,
and determines for each parameter its data type, and if it's required or not.
-You can add an extra option named `description` on each field:
+For Form Types, you can add an extra option named `description` on each field:
``` php
-
+
'string',
'required' => true,
'description' => 'A nice description',
+ 'readonly' => false
),
'b' =>
array(
'dataType' => 'string',
'required' => false,
'description' => '',
+ 'readonly' => false
),
'c' =>
array(
'dataType' => 'boolean',
'required' => true,
'description' => '',
+ 'readonly' => false
),
),
'description' => 'create test',
@@ -108,18 +111,21 @@ class SimpleFormatterTest extends WebTestCase
'dataType' => 'string',
'required' => true,
'description' => 'A nice description',
+ 'readonly' => false
),
'b' =>
array(
'dataType' => 'string',
'required' => false,
'description' => '',
+ 'readonly' => false
),
'c' =>
array(
'dataType' => 'boolean',
'required' => true,
'description' => '',
+ 'readonly' => false
),
),
'description' => 'create test',
@@ -138,6 +144,7 @@ class SimpleFormatterTest extends WebTestCase
'dataType' => 'string',
'required' => true,
'description' => 'A nice description',
+ 'readonly' => false
),
),
'description' => 'create another test',