TypeError: Argument 1 passed to FOS\RestBundle\Serializer\Normalizer\FormErrorHandler::__construct() must be an instance of JMS\Serializer\Handler\FormErrorHandler, instance of Symfony\Component\Translation\IdentityTranslator
Can you add some description on how we can reproduce your issue?
I have FosRestBunde and JMSSerializerBundle integrated by replace jms_serializer.form_error_handler.class by FOS\RestBundle\Serializer\Normalizer\FormErrorHandler.
My config.yml file:
parameters:
jms_serializer.form_error_handler.class: FOS\RestBundle\Serializer\Normalizer\FormErrorHandler
This commit https://github.com/FriendsOfSymfony/FOSRestBundle/commit/096e47142da33a0d706e5a6c5562dd039293c0c3#diff-2f2dd8f9f89d6a2ae93756480b5cc6f3
changed FOS\RestBundle\Serializer\Normalizer\FormErrorHandler constructor from TranslatorInterface to JMSFormErrorHandler.
Here is service definition https://github.com/schmittjoh/JMSSerializerBundle/blob/master/Resources/config/services.xml with translator service as agrument
After remove class replacement: jms_serializer.form_error_handler.class: FOS\RestBundle\Serializer\Normalizer\FormErrorHandler bug dissapear
Yeah, using the class parameter is not the way this class is supposed to be used. In fact, I don't think you should have to worry about it at all as the service should be registered by the bundle for you already. I am closing here as there is no bug.
Hello, so from version 2.4 how is the correct way to override the FormErrorHandler? I used to override the parameter jms_serializer.form_error_handler.class.
I have exactly the same issue. What is the proper way to make small modifications to FormErrorHandler after 2.4?
Most helpful comment
Hello, so from version 2.4 how is the correct way to override the FormErrorHandler? I used to override the parameter
jms_serializer.form_error_handler.class.