-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
[DDC-3444] Refresh cascading of lazy loaded associations does not work #1218
base: old-prototype-3.x
Are you sure you want to change the base?
Conversation
Hello, thank you for creating this pull request. I have automatically opened an issue http://www.doctrine-project.org/jira/browse/DDC-3444 We use Jira to track the state of pull requests and the versions they got |
Hello, I know this is somehow off-topic but I can really use some help. There is an issue with refresh on OneToMany relations with orphanRemoval=true. When removeElement is called on the collection the elements is correctly added on the UnitOfWork orphanRemovals. When the main entity is refreshed, the collection is also correctly refreshed, due to cascade refresh, but if the flush is called the element of the collection is removed anyway, because although the collection is correctly refreshed, the UnitOfWork orphanRemovals is not unset for this entity. Any suggestions or workarounds for this issue. Thank you |
All tests pass when this patch is applied to master, therefore either the test is not exposing the issue correctly or it was fixed. @martijndwars please check it again if you can. |
I believe the bug still exists @Ocramius. I tried to provide a clearer test case. It still uses two models: The test case is cluttered with a lot of boilerplate and I had to change some fields from |
Please don't change the visibility just for testing purpose. This is very bad. Changing the visibility to protected impacts the maintenance of the library (we have to provide BC on protected things, or at least try to provide it) |
You should write a test reproducing the actual issue you had (which does not involve accessing internal properties) to ensure things work. |
-1 on the private => protected |
@beberlei 👍 agreed |
This reverts commit 7529ec1.
Thanks for the suggestions, I reverted my last commit. My original test case reproduces the issue I had. However, because it involves concurrency it is a bit hard (and slow) to run the tests. I currently run the following commands in this order (note the two worker instances):
When manually running the above commands the unit test fails. TravisCI will probably skip the test, because it won't have the Gearman workers running. |
It seems like this issue is still in the latest version of Doctrine? |
@yellow1912 since it's not closed: yes, very likely. |
Provided a fix for this in #6798 |
As described in DDC-1987, cascading of a refresh to lazy loaded associations does not work. I designed a test case to illustrate this problem.
The test case uses Gearman to simulate concurrent requests in a single test. This makes things a bit harder to understand, but I had no idea how to simulate concurrency without it. Please let me know how I can improve the test case.