From 95778d96dee0faa7ce6d79bf99033ab2b954c99f Mon Sep 17 00:00:00 2001 From: LordWeedlle Date: Tue, 16 Oct 2018 13:20:14 +0200 Subject: [PATCH] Throw an exception if trying to flush a single entity --- lib/Doctrine/ORM/EntityManager.php | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/lib/Doctrine/ORM/EntityManager.php b/lib/Doctrine/ORM/EntityManager.php index 685fc0d71d7..eadb1f14779 100644 --- a/lib/Doctrine/ORM/EntityManager.php +++ b/lib/Doctrine/ORM/EntityManager.php @@ -348,9 +348,14 @@ public function createQueryBuilder() * * @throws \Doctrine\ORM\OptimisticLockException If a version check on an entity that * makes use of optimistic locking fails. + * + * @throws Exception */ public function flush($entity = null) { + if (!is_null($entity)) + throw new Exception('You shall not use single entity flush!'); + $this->errorIfClosed(); $this->unitOfWork->commit($entity);