[PR #10065] Lazy and eager collection refresh inconsistency #12071

Closed
opened 2026-01-22 16:12:49 +01:00 by admin · 0 comments
Owner

Original Pull Request: https://github.com/doctrine/orm/pull/10065

State: closed
Merged: Yes


When there is a cascade={"refresh"}, EAGER collections are refreshed, LAZY one are not refreshed, even if initialized...

The issue lies in the fact that \Doctrine\ORM\UnitOfWork::cascadeRefresh is 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 cascadeRefresh before 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

**Original Pull Request:** https://github.com/doctrine/orm/pull/10065 **State:** closed **Merged:** Yes --- When there is a `cascade={"refresh"}`, `EAGER` collections are refreshed, `LAZY` one are not refreshed, even if initialized... The issue lies in the fact that `\Doctrine\ORM\UnitOfWork::cascadeRefresh` is 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 `cascadeRefresh` before 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`
admin added the pull-request label 2026-01-22 16:12:49 +01:00
admin closed this issue 2026-01-22 16:12:49 +01:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#12071