@@ -812,14 +812,26 @@ There are several types of normalizers available:
812
812
813
813
:class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ UidNormalizer `
814
814
This normalizer converts objects that implement
815
- :class: `Symfony\\ Component\\ Uid\\ AbstractUid ` into strings. Also it can
816
- denormalize ``uuid `` or ``ulid `` strings to :class: `Symfony\\ Component\\ Uid\\ Uuid `
817
- or :class: `Symfony\\ Component\\ Uid\\ Ulid `.
815
+ :class: `Symfony\\ Component\\ Uid\\ AbstractUid ` into strings.
816
+ The default normalization format for objects that implement :class: `Symfony\\ Component\\ Uid\\ Uuid `
817
+ is the `RFC 4122 `_ format (example: ``d9e7a184-5d5b-11ea-a62a-3499710062d0 ``).
818
+ The default normalization format for objects that implement :class: `Symfony\\ Component\\ Uid\\ Ulid `
819
+ is the Base 32 format (example: ``01E439TP9XJZ9RPFH3T1PYBCR8 ``).
820
+ You can change the string format by setting the serializer context option
821
+ ``UidNormalizer::NORMALIZATION_FORMAT_KEY `` to ``UidNormalizer::NORMALIZATION_FORMAT_BASE_58 ``,
822
+ ``UidNormalizer::NORMALIZATION_FORMAT_BASE_32 `` or ``UidNormalizer::NORMALIZATION_FORMAT_RFC_4122 ``.
823
+
824
+ Also it can denormalize ``uuid `` or ``ulid `` strings to :class: `Symfony\\ Component\\ Uid\\ Uuid `
825
+ or :class: `Symfony\\ Component\\ Uid\\ Ulid `. The format does not matter.
818
826
819
827
.. versionadded :: 5.2
820
828
821
829
The ``UidNormalizer `` was introduced in Symfony 5.2.
822
830
831
+ .. versionadded :: 5.3
832
+
833
+ The ``UidNormalizer `` normalization formats were introduced in Symfony 5.3.
834
+
823
835
.. _component-serializer-encoders :
824
836
825
837
Encoders
@@ -1558,3 +1570,4 @@ Learn more
1558
1570
.. _`Value Objects` : https://en.wikipedia.org/wiki/Value_object
1559
1571
.. _`API Platform` : https://api-platform.com
1560
1572
.. _`list of PHP timezones` : https://www.php.net/manual/en/timezones.php
1573
+ .. _`RFC 4122` : https://tools.ietf.org/html/rfc4122
0 commit comments