Skip to content

Commit f6d4b6c

Browse files
committed
Document BackedEnumNormalizer::ALLOW_INVALID_VALUES context option
1 parent 01afda2 commit f6d4b6c

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

components/serializer.rst

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -851,6 +851,13 @@ The Serializer component provides several built-in normalizers:
851851
:class:`Symfony\\Component\\Serializer\\Normalizer\\BackedEnumNormalizer`
852852
This normalizer converts a \BackedEnum objects into strings or integers.
853853

854+
By default, it throw an exception when data is not belong to a backed enumeration. If you
855+
want ``null`` instead, you can set the ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` option.
856+
857+
.. versionadded:: 6.3
858+
859+
The ``BackedEnumNormalizer::ALLOW_INVALID_VALUES`` context option was introduced in Symfony 6.3.
860+
854861
:class:`Symfony\\Component\\Serializer\\Normalizer\\FormErrorNormalizer`
855862
This normalizer works with classes that implement
856863
:class:`Symfony\\Component\\Form\\FormInterface`.

0 commit comments

Comments
 (0)