Skip to content

Commit 885d65d

Browse files
committed
Minor tweak
1 parent 259d28d commit 885d65d

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

controller.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -555,7 +555,8 @@ 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:
558+
Instead of returning an array of DTO objects, you can tell Symfony to transform
559+
each DTO object into an array and return something like this:
559560

560561
.. code-block:: json
561562
@@ -572,7 +573,8 @@ Nevertheless, if you want to send the array of payloads directly like this:
572573
}
573574
]
574575
575-
Map the parameter as an array and configure the type of each element in the attribute::
576+
To do so, map the parameter as an array and configure the type of each element
577+
using the ``type`` option of the attribute::
576578

577579
public function dashboard(
578580
#[MapRequestPayload(type: UserDTO::class)] array $users
@@ -581,6 +583,10 @@ Map the parameter as an array and configure the type of each element in the attr
581583
// ...
582584
}
583585

586+
.. versionadded:: 7.1
587+
588+
The ``type`` option of ``#[MapRequestPayload]`` was introduced in Symfony 7.1.
589+
584590
Managing the Session
585591
--------------------
586592

0 commit comments

Comments
 (0)