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

Appearance settings

Commit bda85fa

Browse filesBrowse files
committed
feature #11344 [serializer] document DEEP_OBJECT_TO_POPULATE (dbu)
This PR was merged into the master branch. Discussion ---------- [serializer] document DEEP_OBJECT_TO_POPULATE Document the new feature added in symfony/symfony#30607 Commits ------- 7ea06fa document DEEP_OBJECT_TO_POPULATE
2 parents 3cdf828 + 7ea06fa commit bda85fa
Copy full SHA for bda85fa

File tree

1 file changed

+14
-0
lines changed
Filter options

1 file changed

+14
-0
lines changed

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+14Lines 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 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.