Skip to content

Commit 259d28d

Browse files
committed
minor #19764 Documenting items type in the MapRequestPayload attribute (yceruto)
This PR was merged into the 7.1 branch. Discussion ---------- Documenting items type in the MapRequestPayload attribute Fixes #19761 PR: symfony/symfony#54385 Commits ------- fa1934c Documenting items type in the MapRequestPayload attribute
2 parents 1bc5b92 + fa1934c commit 259d28d

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

controller.rst

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -555,6 +555,32 @@ if you want to map a nested array of specific DTOs::
555555
) {}
556556
}
557557

558+
Nevertheless, if you want to send the array of payloads directly like this:
559+
560+
.. code-block:: json
561+
562+
[
563+
{
564+
"firstName": "John",
565+
"lastName": "Smith",
566+
"age": 28
567+
},
568+
{
569+
"firstName": "Jane",
570+
"lastName": "Doe",
571+
"age": 30
572+
}
573+
]
574+
575+
Map the parameter as an array and configure the type of each element in the attribute::
576+
577+
public function dashboard(
578+
#[MapRequestPayload(type: UserDTO::class)] array $users
579+
): Response
580+
{
581+
// ...
582+
}
583+
558584
Managing the Session
559585
--------------------
560586

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy