Skip to content

Commit

Permalink
Minor tweak
Browse files Browse the repository at this point in the history
  • Loading branch information
javiereguiluz committed Apr 16, 2024
1 parent 259d28d commit 885d65d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,7 +555,8 @@ if you want to map a nested array of specific DTOs::
) {}
}

Nevertheless, if you want to send the array of payloads directly like this:
Instead of returning an array of DTO objects, you can tell Symfony to transform
each DTO object into an array and return something like this:

.. code-block:: json
Expand All @@ -572,7 +573,8 @@ Nevertheless, if you want to send the array of payloads directly like this:
}
]
Map the parameter as an array and configure the type of each element in the attribute::
To do so, map the parameter as an array and configure the type of each element
using the ``type`` option of the attribute::

public function dashboard(
#[MapRequestPayload(type: UserDTO::class)] array $users
Expand All @@ -581,6 +583,10 @@ Map the parameter as an array and configure the type of each element in the attr
// ...
}

.. versionadded:: 7.1

The ``type`` option of ``#[MapRequestPayload]`` was introduced in Symfony 7.1.

Managing the Session
--------------------

Expand Down

0 comments on commit 885d65d

Please sign in to comment.