mirror of
https://github.com/doctrine/orm.git
synced 2026-03-23 22:42:18 +01:00
[PR #169] [MERGED] preFlush event and lifecycle callback #7810
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/doctrine/orm/pull/169
Author: @everzet
Created: 10/23/2011
Status: ✅ Merged
Merged: 11/13/2011
Merged by: @beberlei
Base:
master← Head:PreFlush-event📝 Commits (4)
66e2a92added PreFlush lifetime event and lifecycle callback20ed886added test for PreFlush lifetime event91d8829removed non-used code9c4c06coptimized PreFlush (moved into computeChangeSet function)📊 Changes
6 files changed (+110 additions, -0 deletions)
View changed files
➕
lib/Doctrine/ORM/Event/PreFlushEventArgs.php(+53 -0)📝
lib/Doctrine/ORM/Events.php(+7 -0)📝
lib/Doctrine/ORM/Mapping/Driver/AnnotationDriver.php(+4 -0)📝
lib/Doctrine/ORM/Mapping/Driver/DoctrineAnnotations.php(+6 -0)📝
lib/Doctrine/ORM/UnitOfWork.php(+10 -0)📝
tests/Doctrine/Tests/ORM/Functional/LifecycleCallbackTest.php(+30 -0)📄 Description
For now, we have
@PrePersist,@PreUpdateand@PreRemovecallbacks. But it's not enough, cuz in some cases we need to run some entity method just before everyEntityManager#flush()call (examples - translatable behavior and file uploading routines).I've added and tested new
@PreFlushevent, which occurs during the start of theEntityManager#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.🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.