Skip to content

Commit 3e2e30f

Browse files
Minor reword
1 parent 8d6ca70 commit 3e2e30f

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

components/serializer.rst

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1304,23 +1304,22 @@ the :class:`Symfony\\Component\\Serializer\\Serializer` class will call the
13041304
(or :method:`Symfony\\Component\\Serializer\\Normalizer\\DenormalizerInterface::supportsDenormalization`)
13051305
of all registered normalizers (or denormalizers) in a loop.
13061306

1307-
The result of these methods can vary depending of the value of the object to serialize, of the format to
1308-
use, and of the context. Consequently, **it is not cached** by default.
1309-
1310-
Because they are called recursively, these methods are usually a huge performance bottleneck. Moreover, most
1311-
normalizers (and denormalizers) always return the same result when the object's type, and the format are
1312-
the same.
1313-
1314-
To hint the serializer that it's safe to cache the result of these methods (and then dramatically improve the
1315-
overall performance), such normalizers (and denormalizers) should implement the
1316-
:class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface` and return ``true`` when
1307+
The result of these methods can vary depending on the object to serialize, the
1308+
format and the context. That's why the result **is not cached** by default and
1309+
can result in a significant performance bottleneck.
1310+
1311+
However, most normalizers (and denormalizers) always return the same result when
1312+
the object's type and the format are the same, so the result can be cached. To
1313+
do so, make those normalizers (and denormalizers) implement the
1314+
:class:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface`
1315+
and return ``true`` when
13171316
:method:`Symfony\\Component\\Serializer\\Normalizer\\CacheableSupportsMethodInterface::hasCacheableSupportsMethod`
13181317
is called.
13191318

1320-
.. note::
1321-
1322-
Built-in :ref:`normalizers and denormalizers <component-serializer-normalizers>`, as well the ones
1323-
included in `API Platform`_ natively implement this interface.
1319+
.. note::
1320+
1321+
All built-in :ref:`normalizers and denormalizers <component-serializer-normalizers>`
1322+
as well the ones included in `API Platform`_ natively implement this interface.
13241323

13251324
Learn more
13261325
----------

0 commit comments

Comments
 (0)