Spanner/src/Transaction.php
public function commit(array $options = [])
    {
        if ($this->state !== self::STATE_ACTIVE) {
            throw new \BadMethodCallException('The transaction cannot be committed because it is not active');
        }

        if (!$this->singleUseState()) {
            $this->state = self::STATE_COMMITTED;
        }

        $options += [
            'mutations' => []
        ];

        $options['mutations'] += $this->mutations;

        $options['transactionId'] = $this->transactionId;

        $t = $this->transactionOptions($options);

        $options[$t[1]] = $t[0];

        return $this->operation->commit($this->session, $this->pluck('mutations', $options), $options);
    }
public function commit(array $options = [])
    {
        if ($this->state !== self::STATE_ACTIVE) {
            throw new \BadMethodCallException('The transaction cannot be committed because it is not active');
        }

        if (!$this->singleUseState()) {
            $this->state = self::STATE_COMMITTED;
        }

        $options += [
            'mutations' => []
        ];

        $options['mutations'] += $this->mutations;

        $options['transactionId'] = $this->transactionId;

        $t = $this->transactionOptions($options);

        $options[$t[1]] = $t[0];

        return $this->operation->commit($this->session, $this->pluck('mutations', $options), $options);
    }
public function commit ( array $ options = [ ] ) { if ( $ this -> state !== self :: STATE_ACTIVE ) { throw new \ BadMethodCallException ( 'The transaction cannot be committed because it is not active' ) ; } if ( ! $ this -> singleUseState ( ) ) { $ this -> state = self :: STATE_COMMITTED ; } $ options += [ 'mutations' => [ ] ] ; $ options [ 'mutations' ] += $ this -> mutations ; $ options [ 'transactionId' ] = $ this -> transactionId ; $ t = $ this -> transactionOptions ( $ options ) ; $ options [ $ t [ 1 ] ] = $ t [ 0 ] ; return $ this -> operation -> commit ( $ this -> session , $ this -> pluck ( 'mutations' , $ options ) , $ options ) ; }
Commit and end the transaction.

It is advised that transactions be run inside
{@see Google\Cloud\Spanner\Database::runTransaction()} in order to take
advantage of automated transaction retry in case of a transaction aborted
error.

Example:
```
$transaction->commit();
```

@param array $options [optional] {
Configuration Options.

@type array $mutations An array of mutations to commit. May be used
instead of or in addition to enqueing mutations separately.
}
@return Timestamp The commit timestamp.
@throws \BadMethodCall If the transaction is not active or already used.
@throws AbortedException If the commit is aborted for any reason.
Commit and end the transaction .