Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit eaf4fe4

Browse files
committed
minor #18779 [Serializer] Use NormalizerInterface instead of ObjectNormalizer (mtarld)
This PR was merged into the 6.3 branch. Discussion ---------- [Serializer] Use `NormalizerInterface` instead of `ObjectNormalizer` As mentioned in symfony/maker-bundle#1252 (comment), the documentation is telling to use a concrete implementation of the `NormalizerInteface`. This is not the best in terms of OOP, and moreover doesn't work since Symfony 6.1 and the introduction of `TraceableNormalizer`. Commits ------- 3e9af1b [Serializer] Use NormalizerInterface instead of ObjectNormalizer
2 parents 717bcf3 + 3e9af1b commit eaf4fe4

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

serializer/custom_normalizer.rst

+9
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,15 @@ to customize the normalized data. To do that, leverage the ``ObjectNormalizer``:
4848
}
4949
}
5050

51+
.. deprecated:: 6.1
52+
53+
Injecting an ``ObjectNormalizer`` in your custom normalizer is deprecated
54+
since Symfony 6.1. Implement the
55+
:class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerAwareInterface`
56+
and use the
57+
:class:`Symfony\\Component\\Serializer\\Normalizer\\NormalizerAwareTrait` instead
58+
to inject the ``$normalizer`` property.
59+
5160
Registering it in your Application
5261
----------------------------------
5362

0 commit comments

Comments
 (0)