@@ -829,21 +829,25 @@ The Serializer component provides several built-in normalizers:
829
829
830
830
:class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ UidNormalizer `
831
831
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.
835
843
836
844
.. versionadded :: 5.2
837
845
838
846
The ``UidNormalizer `` was introduced in Symfony 5.2.
839
847
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
844
849
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.
847
851
848
852
.. _component-serializer-encoders :
849
853
@@ -1616,3 +1620,4 @@ Learn more
1616
1620
.. _`Value Objects` : https://en.wikipedia.org/wiki/Value_object
1617
1621
.. _`API Platform` : https://api-platform.com
1618
1622
.. _`list of PHP timezones` : https://www.php.net/manual/en/timezones.php
1623
+ .. _`RFC 4122` : https://tools.ietf.org/html/rfc4122
0 commit comments