Skip to content

Commit

Permalink
Disallow nested commits
Browse files Browse the repository at this point in the history
  • Loading branch information
malarzm committed Jan 7, 2018
1 parent f078de3 commit 5597221
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions lib/Doctrine/ODM/MongoDB/MongoDBException.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,4 +159,9 @@ public static function failedToEnsureDocumentSharding($className, $errorMessage)
$errorMessage
));
}

public static function commitInProgress()
{
return new self('There is already a commit operation in progress');
}
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -394,7 +394,7 @@ public function commit($document = null, array $options = array())

$this->commitsInProgress++;
if ($this->commitsInProgress > 1) {
@trigger_error('There is already a commit operation in progress. Calling flush in an event subscriber is deprecated and will be forbidden in 2.0.', E_USER_DEPRECATED);
throw MongoDBException::commitInProgress();
}
try {
if ($this->orphanRemovals) {
Expand Down

0 comments on commit 5597221

Please sign in to comment.