-
-
Notifications
You must be signed in to change notification settings - Fork 585
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow multiple nested serializer calls #341
Allow multiple nested serializer calls #341
Conversation
Any news about this PR ? |
I'm not sure whether we need to support this use-case, i.e. nested calls. I think it might be better to create another serializer instance if you need this instead of using the same instance. |
Thanks for the quick answer 😃 This could be out of the scope of the current debate, but may I ask you the proper way to do that, as I need to register my custom handlers too, in the context of a Symfony 2 application ? However, for my use case, using the |
I find it disturbing that we need a fresh new Isn't it like saying |
yeah ran into the same issue here...sadly the serializer is somewhat stateful and thats a bad design here in my eyes |
@schmittjoh why are you blocking this valid use case? |
if you have a more complex serializer construction (custom handlers, event subscribers, object constructor etcpp) this is a pain in the ass. |
👍 |
@schmittjoh this helps especially when using this with Symfony so that you can reuse the injected serializer in different parts of the same code run. |
I created a new branch that mimics this but on the latest code base with a few additions. #453 |
👍 |
Do not know if this is still an issue, but #453 (comment) proposes an alternative implementation for this feature |
Nested serialization calls currently require big changes, for a relatively small benefit. Probably getting a new serializer instance can partially fix the issue. Not planning to accept the feature for now. |
So this makes the serializer stateful and unusable as a service, with all the performance and memory consumption downsides. This is a blocker for "real life" production usage, as explained in the previous comments. This has proven to be blocking in at least 3 or 4 of our client projects, and should be clearly stated in the documentation: "jms-serializer is stateful and doesn't care of performance issues". |
👍 |
In case of serializer recursion, the serializer send an exception: "Can't pop from an empty datastructure", as noted by @damienalexandre in #319
This PR allows to stack the navigator association to visitors, thus making it possible to nest serializer calls. It contains two commits: