Skip to content

Commit

Permalink
Documenting items type in the MapRequestPayload attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
yceruto committed Apr 7, 2024
1 parent d517b34 commit fa1934c
Showing 1 changed file with 26 additions and 0 deletions.
26 changes: 26 additions & 0 deletions controller.rst
Original file line number Diff line number Diff line change
Expand Up @@ -555,6 +555,32 @@ if you want to map a nested array of specific DTOs::
) {}
}

Nevertheless, if you want to send the array of payloads directly like this:

.. code-block:: json
[
{
"firstName": "John",
"lastName": "Smith",
"age": 28
},
{
"firstName": "Jane",
"lastName": "Doe",
"age": 30
}
]
Map the parameter as an array and configure the type of each element in the attribute::

public function dashboard(
#[MapRequestPayload(type: UserDTO::class)] array $users
): Response
{
// ...
}

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

Expand Down

0 comments on commit fa1934c

Please sign in to comment.