Skip to content

Commit 369ea13

Browse files
gilles-gwouterj
authored andcommitted
add caution for datetime object
1 parent 58d4112 commit 369ea13

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

serializer.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,12 @@ Custom normalizers and/or encoders can also be loaded by tagging them as
115115
:ref:`serializer.encoder <reference-dic-tags-serializer-encoder>`. It's also
116116
possible to set the priority of the tag in order to decide the matching order.
117117

118+
.. caution::
119+
120+
Always make sure to load the ``DateTimeNormalizer`` when serializing the
121+
``DateTime`` or ``DateTimeImmutable`` classes to avoid excessive memory
122+
usage and exposing internal details.
123+
118124
Here is an example on how to load the
119125
:class:`Symfony\\Component\\Serializer\\Normalizer\\GetSetMethodNormalizer`, a
120126
faster alternative to the `ObjectNormalizer` when data objects always use

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy