Skip to content

Commit 7ea06fa

Browse files
committed
document DEEP_OBJECT_TO_POPULATE
1 parent 06bcae7 commit 7ea06fa

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

components/serializer.rst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,20 @@ The serializer can also be used to update an existing object::
210210

211211
This is a common need when working with an ORM.
212212

213+
The ``OBJECT_TO_POPULATE`` is only used for the top level object. If that object
214+
is the root of a tree structure, all child elements that exist in the
215+
normalized data will be re-created with new instances.
216+
217+
..versionadded:: 4.3
218+
219+
Symfony 4.3 introduces a new option ``AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE``.
220+
When this flag is set to true, existing children of the root ``OBJECT_TO_POPULATE`` are
221+
updated from the normalized data, instead of the denormalizer re-creating them.
222+
223+
Note that ``DEEP_OBJECT_TO_POPULATE`` only works for single child objects,
224+
but not for arrays of objects. Those will still be replaces when present in
225+
the normalized data.
226+
213227
.. _component-serializer-attributes-groups:
214228

215229
Attributes Groups

0 commit comments

Comments
 (0)