Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit ebdf28d

Browse filesBrowse files
fancywebjaviereguiluz
authored andcommitted
[Serializer] Add UidNormalizer normalization formats
1 parent 0006353 commit ebdf28d
Copy full SHA for ebdf28d

File tree

1 file changed

+14
-9
lines changed
Filter options

1 file changed

+14
-9
lines changed

‎components/serializer.rst

Copy file name to clipboardExpand all lines: components/serializer.rst
+14-9Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -829,21 +829,25 @@ The Serializer component provides several built-in normalizers:
829829

830830
:class:`Symfony\\Component\\Serializer\\Normalizer\\UidNormalizer`
831831
This normalizer converts objects that implement
832-
:class:`Symfony\\Component\\Uid\\AbstractUid` into strings. Also it can
833-
denormalize ``uuid`` or ``ulid`` strings to :class:`Symfony\\Component\\Uid\\Uuid`
834-
or :class:`Symfony\\Component\\Uid\\Ulid`.
832+
:class:`Symfony\\Component\\Uid\\AbstractUid` into strings.
833+
The default normalization format for objects that implement :class:`Symfony\\Component\\Uid\\Uuid`
834+
is the `RFC 4122`_ format (example: ``d9e7a184-5d5b-11ea-a62a-3499710062d0``).
835+
The default normalization format for objects that implement :class:`Symfony\\Component\\Uid\\Ulid`
836+
is the Base 32 format (example: ``01E439TP9XJZ9RPFH3T1PYBCR8``).
837+
You can change the string format by setting the serializer context option
838+
``UidNormalizer::NORMALIZATION_FORMAT_KEY`` to ``UidNormalizer::NORMALIZATION_FORMAT_BASE_58``,
839+
``UidNormalizer::NORMALIZATION_FORMAT_BASE_32`` or ``UidNormalizer::NORMALIZATION_FORMAT_RFC_4122``.
840+
841+
Also it can denormalize ``uuid`` or ``ulid`` strings to :class:`Symfony\\Component\\Uid\\Uuid`
842+
or :class:`Symfony\\Component\\Uid\\Ulid`. The format does not matter.
835843

836844
.. versionadded:: 5.2
837845

838846
The ``UidNormalizer`` was introduced in Symfony 5.2.
839847

840-
.. note::
841-
842-
You can also create your own Normalizer to use another structure. Read more at
843-
:doc:`/serializer/custom_normalizer`.
848+
.. versionadded:: 5.3
844849

845-
All these normalizers are enabled by default when using the Serializer component
846-
in a Symfony application.
850+
The ``UidNormalizer`` normalization formats were introduced in Symfony 5.3.
847851

848852
.. _component-serializer-encoders:
849853

@@ -1616,3 +1620,4 @@ Learn more
16161620
.. _`Value Objects`: https://en.wikipedia.org/wiki/Value_object
16171621
.. _`API Platform`: https://api-platform.com
16181622
.. _`list of PHP timezones`: https://www.php.net/manual/en/timezones.php
1623+
.. _`RFC 4122`: https://tools.ietf.org/html/rfc4122

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.