Lazy and eager collection refresh inconsistency#10065
Lazy and eager collection refresh inconsistency#10065greg0ire merged 2 commits intodoctrine:2.20.xfrom
Conversation
|
first commit add the test, the second provides a fix for it |
SenseException
left a comment
There was a problem hiding this comment.
Builds are green. Do you still expect BC breaks despite that?
|
i do not think that this would cause bc breaks. one of my questions here is: should i do the same fore the detach cascade operation? i'm pretty sure it has the same buggy behavior |
|
hi, are there any comment on this? is there an interest in merging it? |
|
There hasn't been any activity on this pull request in the past 90 days, so it has been marked as stale and it will be closed automatically if no further activity occurs in the next 7 days. |
|
I think that this is still relevant for 2.x... |
Well then yes. Also, please rebase on 2.20.x 🙏
The fact that you did not break any test by changing the code makes me think it was not intentionally like this, and the patch looks sensible, so I'm OK with this on principle, will merge after my comments are addressed. Thanks for working on this. |
b42f949 to
76ff717
Compare
76ff717 to
7d1b24f
Compare
|
@greg0ire thanks for looking again into this! I have rebased it and targeted 2.20.x as base branch. |
|
The psalm failure seems unrelated to my change (it is failing in the base branch as well) |
|
Thanks @goetas , please go ahead with |
|
Created #11717 for the detach feature |
When there is a
cascade={"refresh"},EAGERcollections are refreshed,LAZYone are not refreshed, even if initialized...The issue lies in the fact that
\Doctrine\ORM\UnitOfWork::cascadeRefreshis called after the entity holding that collection has been refreshed, thus the lazy collections in there that have been edited are not refreshed (because the initial entity refresh has marked them as not initialized).Moving the
cascadeRefreshbefore the entity is refreshed.. but that might break other things... i'm waiting for github actions to tell.I fear that the same should be done for
\Doctrine\ORM\UnitOfWork::cascadeDetach