Skip to content

Commit 5c94785

Browse files
committed
Added option to disable type enforcement in serializer
1 parent 7bb20ba commit 5c94785

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

components/serializer.rst

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -877,7 +877,7 @@ parameter of the ``ObjectNormalizer``::
877877
public $bar;
878878
}
879879

880-
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor()); //
880+
$normalizer = new ObjectNormalizer(null, null, null, new ReflectionExtractor());
881881
$serializer = new Serializer(array(new DateTimeNormalizer(), $normalizer));
882882

883883
$obj = $serializer->denormalize(
@@ -892,7 +892,9 @@ parameter of the ``ObjectNormalizer``::
892892
When a ``PropertyTypeExtractor`` is available, the normalizer will also check that the data to denormalize
893893
matches the type of the property (even for primitive types). For instance, if a ``string`` is provided, but
894894
the type of the property is ``int``, an :class:`Symfony\\Component\\Serializer\\Exception\\UnexpectedValueException`
895-
will be thrown.
895+
will be thrown. The type enforcement of the properties can be disabled by setting
896+
the serializer context option ``ObjectNormalizer::DISABLE_TYPE_ENFORCEMENT``
897+
to ``true``.
896898

897899
Learn more
898900
----------

0 commit comments

Comments
 (0)