Remove call to EntityManager#flush() if the unitofwork contains pending insertions. Flush should always be triggered explicitly.
This commit is contained in:
parent
4f154b6aa1
commit
3c0f92f4c7
@ -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);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user