JMSSerializerBundle
JMSSerializerBundle copied to clipboard
Ability to use multiple visitors for same format
I need to have the serializer to treat null values as an empty string for some models (but not globally) and an obvious solution is to write a custom visitor implementing visitNull.
But the only way I see to use the custom visitor is to redefine the visitor service class parameter, which affects the whole project rather than selected entities.
I cannot use a custom handler for that because the GraphNavigator resets the data type and type arguments if the value is null.
So, is there any option to use a custom visitor only for selected entities or maybe there's another way to customize null-serialization behavior?
an obvious solution is to write a custom visitor implementing visitNull.
Why not just implement a custom exclusion strategy?
This (https://github.com/schmittjoh/serializer/pull/790) has been merged recently.. can it be helpful?