mirror of
https://github.com/doctrine/orm.git
synced 2026-03-24 06:52:09 +01:00
DDC-3356: Event/Entity Listener onFlush() works but not preFlush() #4145
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?
Originally created by @doctrinebot on GitHub (Oct 18, 2014).
Originally assigned to: @Ocramius on GitHub.
Jira issue originally created by user Max:
preFlush() example below don't do anything at all although it is 99% exactly the same as onFlush() which works as expected. Can anyone tell me what I am missing or what the reason is and the solution?
DEBUGGING TEST:
public function preFlush(PreFlushEventArgs $args) { $em = $args->getEntityManager(); $uow = $em->getUnitOfWork(); echo '1'; foreach ($uow->getScheduledEntityUpdates() as $entity) { echo '2'; if ($entity instanceof User) { echo '3'; } } exit; }DEBUGGING RESULT:
1so$uow->getScheduledEntityUpdates()is an empty array!