DDC-1479: GH-169: preFlush event and lifecycle callback #1860

Closed
opened 2026-01-22 13:28:39 +01:00 by admin · 4 comments
Owner

Originally created by @doctrinebot on GitHub (Nov 8, 2011).

Originally assigned to: @beberlei on GitHub.

Jira issue originally created by user @beberlei:

Pull-Request was automatically synchronized: https://github.com/doctrine/doctrine2/pull/169

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.

Originally created by @doctrinebot on GitHub (Nov 8, 2011). Originally assigned to: @beberlei on GitHub. Jira issue originally created by user @beberlei: Pull-Request was automatically synchronized: https://github.com/doctrine/doctrine2/pull/169 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 Bug label 2026-01-22 13:28:39 +01:00
admin closed this issue 2026-01-22 13:28:41 +01:00
Author
Owner

@doctrinebot commented on GitHub (Nov 13, 2011):

Comment created by @beberlei:

Merged into master

@doctrinebot commented on GitHub (Nov 13, 2011): Comment created by @beberlei: Merged into master
Author
Owner

@doctrinebot commented on GitHub (Nov 13, 2011):

Issue was closed with resolution "Fixed"

@doctrinebot commented on GitHub (Nov 13, 2011): Issue was closed with resolution "Fixed"
Author
Owner

@doctrinebot commented on GitHub (Jul 9, 2012):

Comment created by @beberlei:

A related Github Pull-Request [GH-169] was opened
https://github.com/doctrine/dbal/pull/169

@doctrinebot commented on GitHub (Jul 9, 2012): Comment created by @beberlei: A related Github Pull-Request [GH-169] was opened https://github.com/doctrine/dbal/pull/169
Author
Owner

@doctrinebot commented on GitHub (Jul 10, 2012):

Comment created by @beberlei:

A related Github Pull-Request [GH-169] was closed
https://github.com/doctrine/dbal/pull/169

@doctrinebot commented on GitHub (Jul 10, 2012): Comment created by @beberlei: A related Github Pull-Request [GH-169] was closed https://github.com/doctrine/dbal/pull/169
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: doctrine/archived-orm#1860