From 93cec5fcd819cc6fcaec4b14485e020443cc4804 Mon Sep 17 00:00:00 2001 From: Matt Janssen Date: Thu, 21 Dec 2023 10:59:59 +0100 Subject: [PATCH] [Value Resolver] Added `RequestPayloadValueResolver` section Co-authored-by: Alexandre Daubois <2144837+alexandre-daubois@users.noreply.github.com> --- controller.rst | 4 ++++ controller/value_resolver.rst | 15 +++++++++++++++ 2 files changed, 19 insertions(+) diff --git a/controller.rst b/controller.rst index 6837c28c837..8e8c5d193e9 100644 --- a/controller.rst +++ b/controller.rst @@ -388,6 +388,8 @@ attribute, arguments of your controller's action can be automatically fulfilled: The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryParameter` attribute was introduced in Symfony 6.3. +.. _controller-mapping-query-string: + Mapping The Whole Query String ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ @@ -445,6 +447,8 @@ You can customize the validation groups used during the mapping thanks to the The :class:`Symfony\\Component\\HttpKernel\\Attribute\\MapQueryString` attribute was introduced in Symfony 6.3. +.. _controller-mapping-request-payload: + Mapping Request Payload ~~~~~~~~~~~~~~~~~~~~~~~ diff --git a/controller/value_resolver.rst b/controller/value_resolver.rst index 71efd680b08..7509920bc04 100644 --- a/controller/value_resolver.rst +++ b/controller/value_resolver.rst @@ -79,6 +79,19 @@ Symfony ships with the following value resolvers in the The ``BackedEnumValueResolver`` and ``EnumRequirement`` were introduced in Symfony 6.1. + +:class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestPayloadValueResolver` + Maps the request payload or the query string into the type-hinted object. + + Because this is a :ref:`targeted value resolver `, + you'll have to use either the :ref:`MapRequestPayload ` + or the :ref:`MapQueryString ` attribute + in order to use this resolver. + + .. versionadded:: 6.3 + + The ``RequestPayloadValueResolver`` was introduced in Symfony 6.3. + :class:`Symfony\\Component\\HttpKernel\\Controller\\ArgumentResolver\\RequestAttributeValueResolver` Attempts to find a request attribute that matches the name of the argument. @@ -430,6 +443,8 @@ command to see which argument resolvers are present and in which order they run: You can also configure the name passed to the ``ValueResolver`` attribute to target your resolver. Otherwise it will default to the service's id. +.. _value-resolver-targeted: + ``controller.targeted_value_resolver`` ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~