Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit259d28d

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 attributeFixes#19761PR:symfony/symfony#54385Commits-------fa1934c Documenting items type in the MapRequestPayload attribute
2 parents1bc5b92 +fa1934c commit259d28d

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)

[8]ページ先頭

©2009-2025 Movatter.jp