@@ -801,8 +801,55 @@ The Serializer component provides several built-in normalizers:
801801 You can also create your own Normalizer to use another structure. Read more at
802802 :doc: `/serializer/custom_normalizer `.
803803
804- All these normalizers are enabled by default when using the Serializer component
805- in a Symfony application.
804+ Certain normalizers are enabled by default when using the Serializer component
805+ in a Symfony application, additional ones can be enabled by tagging them with
806+ :ref: `serializer.normalizer <reference-dic-tags-serializer-normalizer >`.
807+
808+ Here is an example of how to enable the built-in
809+ :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ GetSetMethodNormalizer `, a
810+ faster alternative to the
811+ :class: `Symfony\\ Component\\ Serializer\\ Normalizer\\ ObjectNormalizer `:
812+
813+ .. configuration-block ::
814+
815+ .. code-block :: yaml
816+
817+ # config/services.yaml
818+ services :
819+ get_set_method_normalizer :
820+ class : Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer
821+ tags : [serializer.normalizer]
822+
823+ .. code-block :: xml
824+
825+ <!-- config/services.xml -->
826+ <?xml version =" 1.0" encoding =" UTF-8" ?>
827+ <container xmlns =" http://symfony.com/schema/dic/services"
828+ xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
829+ xsi : schemaLocation =" http://symfony.com/schema/dic/services
830+ https://symfony.com/schema/dic/services/services-1.0.xsd" >
831+
832+ <services >
833+ <service id =" get_set_method_normalizer" class =" Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer" >
834+ <tag name =" serializer.normalizer" />
835+ </service >
836+ </services >
837+ </container >
838+
839+ .. code-block :: php
840+
841+ // config/services.php
842+ namespace Symfony\Component\DependencyInjection\Loader\Configurator;
843+
844+ use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
845+
846+ return function(ContainerConfigurator $configurator) {
847+ $services = $configurator->services();
848+
849+ $services->set('get_set_method_normalizer', GetSetMethodNormalizer::class)
850+ ->tag('serializer.normalizer')
851+ ;
852+ };
806853
807854 .. _component-serializer-encoders :
808855
0 commit comments