[PR #169] preFlush event and lifecycle callback #7813

Closed
opened 2026-01-22 15:56:59 +01:00 by admin · 0 comments
Owner

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

State: closed
Merged: Yes


For now, we have @PrePersist, @PreUpdate and @PreRemove callbacks. But it's not enough, cuz in some cases we need to run some entity method just before every EntityManager#flush() call (examples - translatable behavior and file uploading routines).

I've added and tested new @PreFlush event, which occurs during the start of the EntityManager#flush(), before any changeset gets calculated. This gives users ability to hook into flush process and prepare their entities to save even if they were not changed.

**Original Pull Request:** https://github.com/doctrine/orm/pull/169 **State:** closed **Merged:** Yes --- For now, we have `@PrePersist`, `@PreUpdate` and `@PreRemove` callbacks. But it's not enough, cuz in some cases we need to run some entity method just before **every** `EntityManager#flush()` call (examples - translatable behavior and file uploading routines). I've added and tested new `@PreFlush` event, which occurs during the start of the `EntityManager#flush()`, before any changeset gets calculated. This gives users ability to hook into flush process and prepare their entities to save even if they were not changed.
admin added the pull-request label 2026-01-22 15:56:59 +01:00
admin closed this issue 2026-01-22 15:56:59 +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#7813