-
Notifications
You must be signed in to change notification settings - Fork 10
Collect recorded messages on all managed entities even not dirty ones #4
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
Conversation
It seems that the identity map in v2.2 and 2.3 of doctrine was missing the not dirty entities. |
Could you explain this a bit more i'm not sure why the tests are failing know. |
…riggered in Doctrine 2.2 & 2.3 when nothing need to be committed
I added a new test to cover the new feature to collect events of "not dirty" entities. I moved all recording calls in the PreFlush event to fix this. |
@GeoffroyR So if i'm correct this is ready to be merged. I only think we should create a major release for this to not break old implementations. What do you think? |
why not listening "postFlush" ? (just curious) |
@cmodijk should it be considered a major release? It might break existing implementations, but only because they didn't work in the first place. I think this is more a bugfix than a major, but heh, that's only my opinion :) |
Sorry but this still needs some more testing.
I have no time right now but will try to find some time next month to add a series of tests. @docteurklein "postFlush" is not called if nothing is committed in previous versions of Doctrine 2.2 & 2.3 |
I have another issue related to this PR: Scenario: I fetch the E1 from the repository (E2 is not hydrated for the current task), change something on the E1 and record an Event. E2 is still just a Doctrine Proxy object and can per se not contain any messages. The check at Suggestion:
|
@docteurklein You are right but that also means that if someone already implemented a workaround this (like i did myself) is going to be surprised if it is fixed without a major bump i think. And i'm working on the next major versions of al packages to drop support for php 5.4 and 5.5 and I hope i can use this in that.
Do you know why these entities where not in the
I'm not sure but about this do you have a test case for this?
@patrickjahns tnx for the suggestion. @GeoffroyR Are you able to finish this or should i try to make the final changes in the coming weeks? |
… events from Lifecycle events
Codecov Report
@@ Coverage Diff @@
## master #4 +/- ##
=========================================
Coverage ? 97.56%
=========================================
Files ? 2
Lines ? 41
Branches ? 0
=========================================
Hits ? 40
Misses ? 1
Partials ? 0
Continue to review full report at Codecov.
|
I checked back why I had to add the PostFlush and it is related to the lifecycle events. I recorderded some events based on lifecycle events and these were not collected on preFlush. About the collections, I was a bit concerned about cascade events but I did some tests and could not find any caveat. |
Hey everyone, great that this issue receives attention! I do think it requires a major version bump, since otherwise the behavior will be too subtle for people simply upgrading. It's something that needs to be documented well too. |
I agree with @matthiasnoback regarding collections: I don't think you have anything to check manually. |
Oke, but I think the pull request is fine then right? I should be able to merge this now? |
Sorry, wrong button. |
I might be wrong (I didn't make the test but I looked at a generated doctrine proxy) and I don't think checking on initialized proxy has any effect because proxies only initialize if you call methods that touch persisted properties. Can you confirm this behavior? |
From my testing, any method invocation on a unitiliazed proxy object will trigger initialization. (Anything otherwise would cause problems / inconsistencies) |
@docteurklein When you retrieve a Entity with a reference to a other Entity but only fetch the date of the first one the second one still gets a instance with a proxy implementation. When we then in our listener call the |
ha ok thanks for the explanations! |
@docteurklein No problem :-) |
Ping @GeoffroyR i think this can get merged right? |
I tested the basic concept today i'm merging this now and releasing in a bit later today. |
No description provided.