8000 Documenting items type in the MapRequestPayload attribute by yceruto · Pull Request #19764 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Documenting items type in the MapRequestPayload attribute #19764

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 16, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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