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 TransactionOptions.

Options for beginning a new transaction.

Transactions can be created explicitly with calls to
[Datastore.BeginTransaction](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.Client.DatastoreClient#_Google_Cloud_Datastore_V1_Client_DatastoreClient__beginTransaction__)
or implicitly by setting
[ReadOptions.new_transaction](https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.ReadOptions#_Google_Cloud_Datastore_V1_ReadOptions__getNewTransaction__)
in read requests.

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

## Namespace

Google \\ Cloud \\ Datastore \\ V1

## Methods

### __construct

Constructor.

| **Parameters** ||
|---|---|
| **Name** | **Description** |
| `data` | `array` Optional. Data for populating the Message object. |
| `↳ read_write` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.TransactionOptions.ReadWrite` The transaction should allow both reads and writes. |
| `↳ read_only` | `https://docs.cloud.google.com/php/docs/reference/cloud-datastore/latest/V1.TransactionOptions.PBReadOnly` The transaction should only allow reads. |

### getReadWrite

The transaction should allow both reads and writes.

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

### hasReadWrite

### setReadWrite

The transaction should allow both reads and writes.

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

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

### getReadOnly

The transaction should only allow reads.

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

### hasReadOnly

### setReadOnly

The transaction should only allow reads.

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

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

### getMode

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