Skip to content

Commit e869b96

Browse files
committed
add context
1 parent d7b9e43 commit e869b96

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

reference/twig_reference.rst

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -563,20 +563,23 @@ serialize
563563

564564
.. code-block:: twig
565565
566-
{{ object|serialize(format = 'json') }}
566+
{{ object|serialize(format = 'json', context = []) }}
567567
568568
``object``
569-
**type**: ``object``
569+
**type**: ``mixed``
570570

571571
``format`` *(optional)*
572572
**type**: ``string``
573573

574+
``context`` *(optional)*
575+
**type**: ``array``
576+
574577
.. versionadded:: 5.3
575578

576579
The ``serialize`` filter was introduced in Symfony 5.3.
577580

578-
Accepts any object that can be serialized by Symfony's Serializer Component and
579-
returns the serialized object in the specified ``format``.
581+
Accepts any data that can be serialized by Symfony's Serializer Component and
582+
returns a serialized string in the specified ``format``.
580583

581584
.. _reference-twig-tags:
582585

0 commit comments

Comments
 (0)