Google\Cloud\Datastore\Connection\ConnectionInterface::commit PHP Method

commit() public method

public commit ( array $args )
$args array
    public function commit(array $args);

Usage Example

Ejemplo n.º 1
0
 /**
  * Commit all mutations
  *
  * Calling this method will end the operation (and close the transaction,
  * if one is specified).
  *
  * @param array $options [optional] {
  *     Configuration Options
  *
  *     @type string $transaction The transaction ID, if the query should be
  *           run in a transaction.
  * }
  * @return array [Response Body](https://cloud.google.com/datastore/reference/rest/v1/projects/commit#response-body)
  */
 public function commit(array $options = [])
 {
     $options += ['transaction' => null];
     $res = $this->connection->commit($options + ['mode' => $options['transaction'] ? 'TRANSACTIONAL' : 'NON_TRANSACTIONAL', 'mutations' => $this->mutations, 'projectId' => $this->projectId]);
     $this->mutations = [];
     return $res;
 }