@@ -35,9 +35,6 @@ api_platform:
3535 # If you want to serialize only some payload fields, define them like this: [ severity, anotherPayloadField ]
3636 serialize_payload_fields: []
3737
38- # To enable or disable query parameters validation on collection GET requests
39- query_parameter_validation: true
40-
4138 eager_loading:
4239 # To enable or disable eager loading.
4340 enabled: true
@@ -102,10 +99,6 @@ api_platform:
10299 # The list of paths with files or directories where the bundle will look for additional resource files.
103100 paths: []
104101
105- # The list of your resources class directories. Defaults to the directories of the mapping paths but might differ.
106- resource_class_directories:
107- - '%kernel.project_dir%/src/Entity'
108-
109102 doctrine:
110103 # To enable or disable Doctrine ORM support.
111104 enabled: true
@@ -143,17 +136,13 @@ api_platform:
143136 # Enabled by default with installed api-platform/graphql.
144137 enabled: false
145138
146- # The default IDE (graphiql or graphql-playground ) used when going to the GraphQL endpoint. False to disable.
139+ # The default IDE (graphiql) used when going to the GraphQL endpoint. False to disable.
147140 default_ide: 'graphiql'
148141
149142 graphiql:
150143 # Enabled by default with installed api-platform/graphql and Twig.
151144 enabled: false
152145
153- graphql_playground:
154- # Enabled by default with installed api-platform/graphql and Twig.
155- enabled: false
156-
157146 introspection:
158147 # Enabled by default with installed api-platform/graphql.
159148 enabled: true
@@ -211,7 +200,7 @@ api_platform:
211200 enabled: false
212201
213202 # URLs of the Varnish servers to purge using cache tags when a resource is updated.
214- varnish_urls : []
203+ urls : []
215204
216205 # To pass options to the client charged with the request.
217206 request_options: []
@@ -433,9 +422,6 @@ return [
433422 // Enable the serialization of payload fields when a validation error is thrown.
434423 // If you want to serialize only some payload fields, define them like this: [ severity, anotherPayloadField ]
435424 'serialize_payload_fields' => [],
436-
437- // To enable or disable query parameters validation on collection GET requests
438- 'query_parameter_validation' => true,
439425 ],
440426
441427 'eager_loading' => [
@@ -506,11 +492,6 @@ return [
506492 'paths' => [],
507493 ],
508494
509- // The list of your resources class directories. Defaults to the directories of the mapping paths but might differ.
510- 'resource_class_directories' => [
511- '%kernel.project_dir%/src/Entity',
512- ],
513-
514495 'doctrine' => [
515496 // To enable or disable Doctrine ORM support.
516497 'enabled' => true,
@@ -630,7 +611,7 @@ return [
630611 'enabled' => false,
631612
632613 // URLs of the Varnish servers to purge using cache tags when a resource is updated.
633- 'varnish_urls ' => [],
614+ 'urls ' => [],
634615
635616 // To pass options to the client charged with the request.
636617 'request_options' => [],
@@ -829,3 +810,54 @@ return [
829810 ],
830811];
831812```
813+
814+ ## Resolving Container Parameters in Resource Configuration
815+
816+ > [!WARNING] This is not available with Laravel, only with the Symfony integration.
817+
818+ Symfony container parameters (`%app.some_param%`) can be referenced inside resource configuration,
819+ whether it is declared with YAML, XML, or PHP attributes. This lets you keep values such as a
820+ security expression or a route prefix in `parameters.yaml` instead of hard-coding them in the
821+ resource.
822+
823+ Two resolution rules apply, depending on the field:
824+
825+ - On plain string fields (`shortName`, `description`, `uriTemplate`, `routePrefix`, `routeName`,
826+ `host`, `controller`, `provider`, `processor`, `securityMessage`,
827+ `securityPostDenormalizeMessage`, and `securityPostValidationMessage`), `%param%` is resolved
828+ anywhere in the string.
829+ - On ExpressionLanguage fields (`security`, `securityPostDenormalize`, `securityPostValidation`,
830+ `condition`), the whole trimmed value must be a single `%param%` reference to be resolved. A
831+ partial use, or a real modulo expression such as `object.value % 2 === 0`, reaches the expression
832+ engine untouched.
833+
834+ YAML and XML resource configuration also resolve `%param%` in a URI variable `Link`'s `fromClass`
835+ and `toClass` values.
836+
837+ `%%` escapes a literal `%`, and `%env(...)%` parameters are not allowed in resource configuration.
838+
839+ ```yaml
840+ # config/services.yaml
841+ parameters:
842+ app.admin_security: 'is_granted("ROLE_ADMIN")'
843+ ```
844+
845+ ```php
846+ // src/ApiResource/Book.php
847+ namespace App\ApiResource;
848+
849+ use ApiPlatform\Metadata\ApiResource;
850+ use ApiPlatform\Metadata\Get;
851+
852+ #[ApiResource(
853+ operations: [
854+ new Get(security: '%app.admin_security%'),
855+ ],
856+ )]
857+ final class Book
858+ {
859+ }
860+ ```
861+
862+ The same `%app.admin_security%` reference works unchanged in an equivalent YAML or XML resource
863+ configuration file.
0 commit comments