From 3c0f92f4c7daeee029d10302fc9da285f29fc0f2 Mon Sep 17 00:00:00 2001 From: Benjamin Eberlei Date: Sat, 11 Dec 2010 00:54:54 +0100 Subject: [PATCH] Remove call to EntityManager#flush() if the unitofwork contains pending insertions. Flush should always be triggered explicitly. --- lib/Doctrine/ORM/AbstractQuery.php | 9 --------- 1 file changed, 9 deletions(-) diff --git a/lib/Doctrine/ORM/AbstractQuery.php b/lib/Doctrine/ORM/AbstractQuery.php index 562a5d6fb..dd9d1c81a 100644 --- a/lib/Doctrine/ORM/AbstractQuery.php +++ b/lib/Doctrine/ORM/AbstractQuery.php @@ -482,15 +482,6 @@ abstract class AbstractQuery */ public function execute($params = array(), $hydrationMode = null) { - // If there are still pending insertions in the UnitOfWork we need to flush - // in order to guarantee a correct result. - //TODO: Think this over. Its tricky. Not doing this can lead to strange results - // potentially, but doing it could result in endless loops when querying during - // a flush, i.e. inside an event listener. - if ($this->_em->getUnitOfWork()->hasPendingInsertions()) { - $this->_em->flush(); - } - if ($hydrationMode !== null) { $this->setHydrationMode($hydrationMode); }