Skip to content

Commit

Permalink
Merge pull request #3 from LordWeedlle/2.5.1
Browse files Browse the repository at this point in the history
Better handle it in UOW::commit()
  • Loading branch information
sandvige authored Oct 16, 2018
2 parents dfbadfd + 2a0c47b commit 6cc5d43
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
5 changes: 0 additions & 5 deletions lib/Doctrine/ORM/EntityManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -348,14 +348,9 @@ 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
3 changes: 3 additions & 0 deletions lib/Doctrine/ORM/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,9 @@ public function __construct(EntityManagerInterface $em)
*/
public function commit($entity = null)
{
if (!is_null($entity))
throw new Exception('You shall not use single entity flush!');

// Raise preFlush
if ($this->evm->hasListeners(Events::preFlush)) {
$this->evm->dispatchEvent(Events::preFlush, new PreFlushEventArgs($this->em));
Expand Down

0 comments on commit 6cc5d43

Please sign in to comment.