Skip to content

Commit a65b98e

Browse files
committed
[JsonStreamer] Mention how to get the current object in value transformers
1 parent 33ea6e8 commit a65b98e

File tree

1 file changed

+10
-0
lines changed

1 file changed

+10
-0
lines changed

serializer/streaming_json.rst

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -541,6 +541,16 @@ When callables are not enough, you can use a service implementing the
541541
The ``getStreamValueType()`` method must return the value's type as it will
542542
appear in the JSON stream.
543543

544+
.. tip::
545+
546+
The ``$options`` argument of the ``transform()`` method includes a special
547+
option called ``_current_object`` which gives access to the object holding
548+
the current property (or ``null`` if there's none).
549+
550+
.. versionadded:: 7.4
551+
552+
The ``_current_object`` option was introduced in Symfony 7.4.
553+
544554
To use this transformer in a class, configure the ``#[ValueTransformer]`` attribute::
545555

546556
// src/Dto/Dog.php

0 commit comments

Comments
 (0)