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 ce28629

Browse filesBrowse files
94nonijaviereguiluz
authored andcommitted
[Serializer] (re)document PRESERVE_EMPTY_OBJECTS
1 parent ccd1137 commit ce28629
Copy full SHA for ce28629

File tree

1 file changed

+7
-0
lines changed
Filter options

1 file changed

+7
-0
lines changed

‎serializer.rst

Copy file name to clipboardExpand all lines: serializer.rst
+7Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1571,6 +1571,13 @@ to ``true``::
15711571
]);
15721572
// $jsonContent contains {"name":"Jane Doe"}
15731573

1574+
Preserving Empty Objetcs
1575+
~~~~~~~~~~~~~~~~~~~~~~~~
1576+
1577+
By default, the Serializer will transform an empty array to `[]`.
1578+
You can change this behavior by setting the ``AbstractObjectNormalizer::PRESERVE_EMPTY_OBJECTS`` context option
1579+
to ``true``, when the value is `\ArrayObject()` the serialization would be `{}`.
1580+
15741581
Handling Uninitialized Properties
15751582
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
15761583

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.