FOSRestBundle icon indicating copy to clipboard operation
FOSRestBundle copied to clipboard

How to use custom jms form error handler

Open philippedebridiers opened this issue 5 years ago • 2 comments

https://github.com/FriendsOfSymfony/FOSRestBundle/blob/e31339f04673e05a6a7c19ba6d8651d8673d5288/Serializer/Normalizer/FormErrorHandler.php#L30

Hi,

I want to customize jms form error handler to change json representation response. How can i do that when the construct parameter attempts JMSFormErrorHandler object ?

thanks for your response

philippedebridiers avatar Mar 29 '19 16:03 philippedebridiers

Have you tried creating a jms handler to serialize your error as you wish?

GuilhemN avatar Apr 10 '19 18:04 GuilhemN

The problem I see is that I can create a custom JMS FormErrorHandler but I need to to customize the general root level format of the error json. That is defined in \FOS\RestBundle\Serializer\Normalizer\FormErrorHandler::adaptFormArray. Is this somehow possible after 2.4? Maybe do another CompilerPass that undoes what's done in JMSFormErrorHandlerPass...

paali avatar Nov 06 '19 12:11 paali