Skip to content

Navigation Menu

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 90ff119

Browse filesBrowse files
committed
minor #16977 [Serializer] fix(serializer): missing empty_array_as_object in example (alanpoulain)
This PR was merged into the 5.4 branch. Discussion ---------- [Serializer] fix(serializer): missing empty_array_as_object in example This PR: - Replaces `empty_iterable_as_object` by `preserve_empty_objects`, like it should be. - Adds `empty_array_as_object` to example in Serializer Context. - Removes the mention `by default`, since it's `false` by default. Related: - #15554 - #15580 - symfony/symfony#42240 - symfony/symfony#42297 Commits ------- cc54517 fix(serializer): missing empty_array_as_object in example
2 parents 5e04bc2 + cc54517 commit 90ff119
Copy full SHA for 90ff119

File tree

1 file changed

+5
-2
lines changed
Filter options

1 file changed

+5
-2
lines changed

‎serializer.rst

Copy file name to clipboardExpand all lines: serializer.rst
+5-2Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -108,12 +108,15 @@ resources. This context is passed to all normalizers. For example:
108108
* :class:`Symfony\\Component\\Serializer\\Normalizer\\DateTimeNormalizer` uses
109109
``datetime_format`` key as date time format;
110110
* :class:`Symfony\\Component\\Serializer\\Normalizer\\AbstractObjectNormalizer`
111-
uses ``empty_iterable_as_object`` to represent empty objects as ``{}`` instead
111+
uses ``preserve_empty_objects`` to represent empty objects as ``{}`` instead
112+
of ``[]`` in JSON.
113+
* :class:`Symfony\\Component\\Serializer\\Serializer`
114+
uses ``empty_array_as_object`` to represent empty arrays as ``{}`` instead
112115
of ``[]`` in JSON.
113116

114117
.. versionadded:: 5.4
115118

116-
The usage of the ``empty_array_as_object`` option by default in the
119+
The usage of the ``empty_array_as_object`` option in the
117120
Serializer was introduced in Symfony 5.4.
118121

119122
You can pass the context as follows::

0 commit comments

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