public function transactional(callable $fn)
    {
        $pdo = $this->getPdo();
        $pdo->beginTransaction();
        try {
            call_user_func($fn);
            $pdo->commit();
        } catch (\Exception $e) {
            $pdo->rollBack();
            throw $e;
        }
    }
public function transactional(callable $fn)
    {
        $pdo = $this->getPdo();
        $pdo->beginTransaction();
        try {
            call_user_func($fn);
            $pdo->commit();
        } catch (\Exception $e) {
            $pdo->rollBack();
            throw $e;
        }
    }
public function transactional ( callable $ fn ) { $ pdo = $ this -> getPdo ( ) ; $ pdo -> beginTransaction ( ) ; try { call_user_func ( $ fn ) ; $ pdo -> commit ( ) ; } catch ( \ Exception $ e ) { $ pdo -> rollBack ( ) ; throw $ e ; } }
Execute a function in a transaction

@param callable $fn
@throws \Exception
Execute a function in a transaction