Google\Cloud\Datastore\DatastoreClient::insert PHP Method

insert() public method

An entity with incomplete keys will be allocated an ID prior to insertion. Insert by this method is non-transactional. If you need transaction support, use {@see \Google\Cloud\Datastore\Transaction::insert()}. Example: $key = $datastore->key('Person', 'Bob'); $entity = $datastore->entity($key, ['firstName' => 'Bob']); $datastore->insert($entity);
public insert ( Entity $entity, array $options = [] ) : string
$entity Entity The entity to be inserted.
$options array [optional] Configuration options.
return string The entity version.
    public function insert(Entity $entity, array $options = [])
    {
        $res = $this->insertBatch([$entity], $options);
        return $this->parseSingleMutationResult($res);
    }