File tree Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Expand file tree Collapse file tree 1 file changed +5
-4
lines changed Original file line number Diff line number Diff line change @@ -212,7 +212,8 @@ These are the options available on the :ref:`serializer context <serializer-cont
212
212
``ignore_empty_attributes `` (default: ``false ``)
213
213
If set to true, ignores all attributes with empty values in the generated XML
214
214
``preserve_numeric_keys `` (default: ``false ``)
215
- If set to true, it keeps numeric array indexes instead of collapsing them into ``<item> `` nodes.
215
+ If set to true, it keeps numeric array indexes (e.g. ``<item key="0"> ``)
216
+ instead of collapsing them into ``<item> `` nodes.
216
217
217
218
.. versionadded :: 7.1
218
219
@@ -224,9 +225,8 @@ These are the options available on the :ref:`serializer context <serializer-cont
224
225
225
226
.. versionadded :: 7.4
226
227
227
- The ``cdata_wrapping_name_pattern `` option was introduced in Symfony 7.4.
228
-
229
- The ``preserve_numeric_keys `` option was introduced in Symfony 7.4.
228
+ The ``cdata_wrapping_name_pattern `` and ``preserve_numeric_keys `` options
229
+ were introduced in Symfony 7.4.
230
230
231
231
Example with a custom ``context ``::
232
232
@@ -281,6 +281,7 @@ Example with ``preserve_numeric_keys``::
281
281
// <lastname>Clay</lastname>
282
282
// </person>
283
283
//</response>
284
+
284
285
$xmlEncoder->encode($data, 'xml', ['preserve_numeric_keys' => true]);
285
286
// outputs:
286
287
//<response>
You can’t perform that action at this time.
0 commit comments