[PR #5570] Fix PrePersist EventListener when using merge instead of persist #9648

Open
opened 2026-01-22 16:04:58 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: No


The merge operation trigger PRE_PERSIST & POST_PERSIST events when we merge a new entity.

The bug that I encounter, is that the PRE_PERSIST event is trigger with the managed copy empty ! I that case my event listener can't access original data.

In order to fix this, I firstly merge entity state into managed copy. I think this is not the best move as it will be copied a second time at line 1888.

I tried to persist after this is done, but it break some unit tests.

**Original Pull Request:** https://github.com/doctrine/orm/pull/5570 **State:** closed **Merged:** No --- The merge operation trigger PRE_PERSIST & POST_PERSIST events when we merge a new entity. The bug that I encounter, is that the PRE_PERSIST event is trigger with the managed copy empty ! I that case my event listener can't access original data. In order to fix this, I firstly merge entity state into managed copy. I think this is not the best move as it will be copied a second time at line 1888. I tried to persist after this is done, but it break some unit tests.
admin added the pull-request label 2026-01-22 16:04:58 +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#9648