public function beginTransaction(?string $savepoint = null): self
    {
        if (null === $savepoint) {
            if (!$this->inTransaction()) {
                $this->execute('BEGIN');
            }

        } elseif (!$this->inTransaction()) {
            throw new exceptions\RuntimeException(
                __METHOD__ . ': Savepoints can only be used in transaction blocks'
            );

        } else {
            $this->execute('SAVEPOINT ' . $savepoint);
        }

        return $this;
    }
public function beginTransaction(?string $savepoint = null): self
    {
        if (null === $savepoint) {
            if (!$this->inTransaction()) {
                $this->execute('BEGIN');
            }

        } elseif (!$this->inTransaction()) {
            throw new exceptions\RuntimeException(
                __METHOD__ . ': Savepoints can only be used in transaction blocks'
            );

        } else {
            $this->execute('SAVEPOINT ' . $savepoint);
        }

        return $this;
    }
public function beginTransaction ( ? string $ savepoint = null ) : self { if ( null === $ savepoint ) { if ( ! $ this -> inTransaction ( ) ) { $ this -> execute ( 'BEGIN' ) ; } } elseif ( ! $ this -> inTransaction ( ) ) { throw new exceptions \ RuntimeException ( __METHOD__ . ': Savepoints can only be used in transaction blocks' ) ; } else { $ this -> execute ( 'SAVEPOINT ' . $ savepoint ) ; } return $ this ; }
Starts a transaction or sets a savepoint

@param string|null $savepoint savepoint name
@return $this
@throws exceptions\RuntimeException if trying to create a savepoint outside the transaction block
Starts a transaction or sets a savepoint