-
-
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
Rebase of serialization nesting onto the latest #453
Conversation
+1 |
+1 This is important because we use the same serializer instance across our Lumen application through DI. My temporary fix for this was to wrap In other words we use a separate instance for serializing nested objects. While this works, it's not as dynamic as using the same instance. |
54c378d
to
e68b24f
Compare
@schmittjoh Any chance of merging this in? Just rebased with the latest from master again. |
e68b24f
to
bec56dd
Compare
@goetas Since you look to be helping now. Any chance of merging this in? |
I see some problems with this PR that makes it "not reday to be merged". First, you have removed tests. Second, this approach complicates all the visitors adding code to handle this specific usecase. Have you considered an approach of recreating only the visitor instance for each seralization call? It should give that same result without changing visitors code... |
@goetas Im not sure what you mean when you say I removed tests. I haven't removed any tests. How would you recreate the visitor instance for each serialization call? |
as you can see on https://github.com/schmittjoh/serializer/pull/453/files there are no tests
https://github.com/schmittjoh/serializer/blob/master/src/JMS/Serializer/Serializer.php#L68 contains the list of visitors. Currently visitors are pre-instantiated in the serialization builder. Doing some kind of lazy-instantiation/callback will allow to instantiate the visitor right when needed. It is a bit more complex feature, but is a general solution to the problem exposed here |
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. |
This is a rebase of #341 on the latest code base. It also adds some accessor methods to remove properties via a callback after it has been serialized.