Skip to content

Commit

Permalink
added check for active transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
v-dem committed Feb 25, 2024
1 parent 18de92c commit 8a8e11d
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Db.php
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,11 @@ public function trans($func)
try {
$result = $func($this);

$this->commit();
if ($this->inTransaction()) {
$this->commit();
} else {
$this->logger->debug('Transaction was not started or already committed.');
}

return $result;
} catch (Exception $e) {
Expand Down

0 comments on commit 8a8e11d

Please sign in to comment.