2.2.0 (latest) 2.0.6 1.34.2 1.33.1 1.32.3 1.31.0 1.30.0 1.29.2 1.28.2 1.26.0 1.25.0 1.24.4 1.23.0 1.22.1 1.21.2 1.19.0 1.18.1 1.17.1 Reference documentation and code samples for the Cloud Datastore V1 Client class Mutation.

A mutation to apply to an entity.

Generated from protobuf message `google.datastore.v1.Mutation`

## Namespace

Google \\ Cloud \\ Datastore \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ insert` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` The entity to insert. The entity must not already exist. The entity key's final path element may be incomplete. |
| `↳ update` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` The entity to update. The entity must already exist. Must have a complete key path. |
| `↳ upsert` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` The entity to upsert. The entity may or may not already exist. The entity key's final path element may be incomplete. |
| `↳ delete` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Key` The key of the entity to delete. The entity may or may not already exist. Must have a complete key path and must not be reserved/read-only. |
| `↳ base_version` | `int|string` The version of the entity that this mutation is being applied to. If this does not match the current version on the server, the mutation conflicts. |
| `↳ update_time` | `Google\Protobuf\Timestamp` The update time of the entity that this mutation is being applied to. If this does not match the current update time on the server, the mutation conflicts. |
| `↳ conflict_resolution_strategy` | `int` The strategy to use when a conflict is detected. Defaults to `SERVER_VALUE`. If this is set, then `conflict_detection_strategy` must also be set. |
| `↳ property_mask` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyMask` The properties to write in this mutation. None of the properties in the mask may have a reserved name, except for `__key__`. This field is ignored for `delete`. If the entity already exists, only properties referenced in the mask are updated, others are left untouched. Properties referenced in the mask but not in the entity are deleted. |
| `↳ property_transforms` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyTransform>` Optional. The transforms to perform on the entity. This field can be set only when the operation is `insert`, `update`, or `upsert`. If present, the transforms are be applied to the entity regardless of the property mask, in order, after the operation. |

### getInsert

The entity to insert. The entity must not already exist.

The entity key's final path element may be incomplete.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity|null` |   |

### hasInsert

### setInsert

The entity to insert. The entity must not already exist.

The entity key's final path element may be incomplete.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdate

The entity to update. The entity must already exist.

Must have a complete key path.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity|null` |   |

### hasUpdate

### setUpdate

The entity to update. The entity must already exist.

Must have a complete key path.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpsert

The entity to upsert. The entity may or may not already exist.

The entity key's final path element may be incomplete.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity|null` |   |

### hasUpsert

### setUpsert

The entity to upsert. The entity may or may not already exist.

The entity key's final path element may be incomplete.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Entity` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getDelete

The key of the entity to delete. The entity may or may not already exist.

Must have a complete key path and must not be reserved/read-only.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Key|null` |   |

### hasDelete

### setDelete

The key of the entity to delete. The entity may or may not already exist.

Must have a complete key path and must not be reserved/read-only.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Key` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getBaseVersion

The version of the entity that this mutation is being applied
to. If this does not match the current version on the server, the
mutation conflicts.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int|string` |   |

### hasBaseVersion

### setBaseVersion

The version of the entity that this mutation is being applied
to. If this does not match the current version on the server, the
mutation conflicts.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int|string` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getUpdateTime

The update time of the entity that this mutation is being applied
to. If this does not match the current update time on the server, the
mutation conflicts.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\Timestamp|null` |   |

### hasUpdateTime

### setUpdateTime

The update time of the entity that this mutation is being applied
to. If this does not match the current update time on the server, the
mutation conflicts.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `Google\Protobuf\Timestamp` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getConflictResolutionStrategy

The strategy to use when a conflict is detected. Defaults to
`SERVER_VALUE`.

If this is set, then `conflict_detection_strategy` must also be set.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `int` | Enum of type [ConflictResolutionStrategy](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Mutation.ConflictResolutionStrategy). |

### setConflictResolutionStrategy

The strategy to use when a conflict is detected. Defaults to
`SERVER_VALUE`.

If this is set, then `conflict_detection_strategy` must also be set.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `int` Enum of type [ConflictResolutionStrategy](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Mutation.ConflictResolutionStrategy). |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPropertyMask

The properties to write in this mutation.

None of the properties in the mask may have a reserved name, except for
`__key__`.
This field is ignored for `delete`.
If the entity already exists, only properties referenced in the mask are
updated, others are left untouched.
Properties referenced in the mask but not in the entity are deleted.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyMask|null` |   |

### hasPropertyMask

### clearPropertyMask

### setPropertyMask

The properties to write in this mutation.

None of the properties in the mask may have a reserved name, except for
`__key__`.
This field is ignored for `delete`.
If the entity already exists, only properties referenced in the mask are
updated, others are left untouched.
Properties referenced in the mask but not in the entity are deleted.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyMask` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getPropertyTransforms

Optional. The transforms to perform on the entity.

This field can be set only when the operation is `insert`, `update`,
or `upsert`. If present, the transforms are be applied to the entity
regardless of the property mask, in order, after the operation.

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `Google\Protobuf\RepeatedField<https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyTransform>` |   |

### setPropertyTransforms

Optional. The transforms to perform on the entity.

This field can be set only when the operation is `insert`, `update`,
or `upsert`. If present, the transforms are be applied to the entity
regardless of the property mask, in order, after the operation.

| **Parameter** ||
|---|---|
| **Name** | **Description** |
| `var` | `array<https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.PropertyTransform>` |

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `$this` |   |

### getOperation

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |

### getConflictDetectionStrategy

| **Returns** ||
|---|---|
| **Type** | **Description** |
| `string` |   |