Skip to content

Commit

Permalink
TransactionListenerのロールバック処理を修正
Browse files Browse the repository at this point in the history
  • Loading branch information
kurozumi committed Jul 21, 2022
1 parent 11db57d commit dbb5442
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/Eccube/EventListener/TransactionListener.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,10 @@ public function onKernelException(ExceptionEvent $event)
return;
}

if ($this->em->getConnection()->isTransactionActive()) {
$this->em->rollback();
if ($this->em->getConnection()->getNativeConnection()->inTransaction()) {
if ($this->em->getConnection()->isRollbackOnly()) {
$this->em->rollback();
}
log_debug('Rollback executed.');
} else {
log_debug('Transaction is not active. Rollback skipped.');
Expand All @@ -123,7 +125,7 @@ public function onKernelTerminate(TerminateEvent $event)

return;
}
if ($this->em->getConnection()->isTransactionActive()) {
if ($this->em->getConnection()->getNativeConnection()->inTransaction()) {
if ($this->em->getConnection()->isRollbackOnly()) {
$this->em->rollback();
log_debug('Rollback executed.');
Expand Down

0 comments on commit dbb5442

Please sign in to comment.