Skip to content

[serializer] document DEEP_OBJECT_TO_POPULATE #11344

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 7, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,20 @@ The serializer can also be used to update an existing object::

This is a common need when working with an ORM.

The ``OBJECT_TO_POPULATE`` is only used for the top level object. If that object
is the root of a tree structure, all child elements that exist in the
normalized data will be re-created with new instances.

..versionadded:: 4.3

Symfony 4.3 introduces a new option ``AbstractObjectNormalizer::DEEP_OBJECT_TO_POPULATE``.
When this flag is set to true, existing children of the root ``OBJECT_TO_POPULATE`` are
updated from the normalized data, instead of the denormalizer re-creating them.

Note that ``DEEP_OBJECT_TO_POPULATE`` only works for single child objects,
but not for arrays of objects. Those will still be replaces when present in
the normalized data.

.. _component-serializer-attributes-groups:

Attributes Groups
Expand Down