Skip to content

Commit

Permalink
Throw an exception if trying to flush a single entity
Browse files Browse the repository at this point in the history
  • Loading branch information
LordWeedlle committed Oct 16, 2018
1 parent d32ce7f commit 95778d9
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 95778d9

Please sign in to comment.