Skip to content

Commit fa1934c

Browse files
committed
Documenting items type in the MapRequestPayload attribute
1 parent d517b34 commit fa1934c

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

controller.rst

+26
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)