public function begin()
    {
        $context = $this->_context;

        $this->logger->info('transaction begin', 'db.transaction.begin');

        if ($context->transaction_level === 0) {
            $this->eventsManager->fireEvent('db:beginTransaction', $this);

            try {
                $connection = $this->poolManager->pop($this, $this->_timeout);

                if (!$connection->beginTransaction()) {
                    throw new DbException('beginTransaction failed.');
                }
                $context->connection = $connection;
            } catch (\PDOException $exception) {
                throw new DbException('beginTransaction failed: ' . $exception->getMessage(), $exception->getCode(), $exception);
            } finally {
                if (!$context->connection) {
                    $this->poolManager->push($this, $context);
                }
            }
        }

        $context->transaction_level++;
    }
public function begin()
    {
        $context = $this->_context;

        $this->logger->info('transaction begin', 'db.transaction.begin');

        if ($context->transaction_level === 0) {
            $this->eventsManager->fireEvent('db:beginTransaction', $this);

            try {
                $connection = $this->poolManager->pop($this, $this->_timeout);

                if (!$connection->beginTransaction()) {
                    throw new DbException('beginTransaction failed.');
                }
                $context->connection = $connection;
            } catch (\PDOException $exception) {
                throw new DbException('beginTransaction failed: ' . $exception->getMessage(), $exception->getCode(), $exception);
            } finally {
                if (!$context->connection) {
                    $this->poolManager->push($this, $context);
                }
            }
        }

        $context->transaction_level++;
    }
public function begin ( ) { $ context = $ this -> _context ; $ this -> logger -> info ( 'transaction begin' , 'db.transaction.begin' ) ; if ( $ context -> transaction_level === 0 ) { $ this -> eventsManager -> fireEvent ( 'db:beginTransaction' , $ this ) ; try { $ connection = $ this -> poolManager -> pop ( $ this , $ this -> _timeout ) ; if ( ! $ connection -> beginTransaction ( ) ) { throw new DbException ( 'beginTransaction failed.' ) ; } $ context -> connection = $ connection ; } catch ( \ PDOException $ exception ) { throw new DbException ( 'beginTransaction failed: ' . $ exception -> getMessage ( ) , $ exception -> getCode ( ) , $ exception ) ; } finally { if ( ! $ context -> connection ) { $ this -> poolManager -> push ( $ this , $ context ) ; } } } $ context -> transaction_level ++ ; }
Starts a transaction in the connection

@return void
@throws \ManaPHP\Db\Exception
Starts a transaction in the connection