Skip to content

Commit

Permalink
Remove transaction
Browse files Browse the repository at this point in the history
  • Loading branch information
davidecesarano committed Jun 16, 2021
1 parent 3aa06ed commit 7b94475
Showing 1 changed file with 0 additions and 25 deletions.
25 changes: 0 additions & 25 deletions Embryo/PDO/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,29 +52,4 @@ public function query(string $query): Query
{
return (new Query($this->pdo))->query($query);
}

/**
* Transaction
*
* @param \Closure $callback
* @return mixed
* @throws \PDOException
*/
public function transaction(\Closure $callback)
{
$callback = \Closure::bind($callback, $this);
try {

$this->pdo->beginTransaction();
$result = $callback();
$this->pdo->commit();
return $result;

} catch (\PDOException $e) {

$this->pdo->rollback();
throw new \PDOException($e->getMessage());

}
}
}

0 comments on commit 7b94475

Please sign in to comment.