8000 Add new serializer empty_data feature doc by Nek- · Pull Request #8914 · symfony/symfony-docs · GitHub
[go: up one dir, main page]

Skip to content

Add new serializer empty_data feature doc #8914

< 8000 /div>
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 3 commits into from
Jun 27, 2018
Merged
Changes from 1 commit
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
Prev Previous commit
Fix not precise enough sentence
  • Loading branch information
Nek- committed Jun 4, 2018
commit 9f31bbb613c7f8257e2f4a94689f84dee6407a1d
5 changes: 3 additions & 2 deletions components/serializer.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1093,8 +1093,9 @@ Handling Constructor Arguments
------------------------------

If the constructor of a class defines arguments, as usually happens with
Copy link
Member
@dunglas dunglas May 16, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not exact: the serializer deals well with constructor arguments, if they are present in the data to deserialize.

The default_constructor_arguments is useful only when the value has not been provided in the data to deserialize.

`Value Objects`_, the serializer won't be able to create the object. In those
cases, use the ``default_constructor_arguments`` context option::
`Value Objects`_, the serializer won't be able to create the object if some
arguments are missing. In those cases, use the ``default_constructor_arguments``
context option::

use Symfony\Component\Serializer\Serializer;
use Symfony\Component\Serializer\Normalizer\ObjectNormalizer;
Expand Down
0