[PR #12147] fix: compute changes on lately added entities for insertions #13526

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

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

State: closed
Merged: No


In the uow the function computeChangeSets will computeScheduleInsertsChangeSets first to get all changes for new insert entities. For freshly added entities during a compute over a cascade persist, a single computeSet will be called, see:

fe48a6d558/src/UnitOfWork.php (L997-L998)

But a persist hook may call a persist on further entities. This entities are dangling in the entityInsertions but never computed. This lead to sql errors later on.

This PR will check entityInsertions that aren't computed yet at the end of computeChangeSets to avoid sql errors.

**Original Pull Request:** https://github.com/doctrine/orm/pull/12147 **State:** closed **Merged:** No --- In the uow the function `computeChangeSets` will `computeScheduleInsertsChangeSets` first to get all changes for new insert entities. For freshly added entities during a compute over a cascade persist, a single computeSet will be called, see: https://github.com/doctrine/orm/blob/fe48a6d5584667fd38984d9ea27b09c3a6797866/src/UnitOfWork.php#L997-L998 But a persist hook may call a persist on further entities. This entities are dangling in the `entityInsertions` but never computed. This lead to sql errors later on. This PR will check `entityInsertions` that aren't computed yet at the end of `computeChangeSets` to avoid sql errors.
admin added the pull-request label 2026-01-22 16:17:22 +01:00
admin closed this issue 2026-01-22 16:17:22 +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#13526