TransactionAttemptContext
in package
Table of Contents
- $transaction : resource
- get() : TransactionGetResult
- Retrieves the value of a document from the collection.
- getMulti() : TransactionGetMultiResult
- Retrieves a group of documents.
- getMultiReplicasFromPreferredServerGroup() : TransactionGetMultiReplicasFromPreferredServerGroupResult
- Retrieves a group of documents, but give priority to copies from preferred server group.
- getReplicaFromPreferredServerGroup() : TransactionGetResult
- Get a document copy from the selected server group.
- insert() : TransactionGetResult
- Inserts a new document to the collection, failing if the document already exists.
- query() : mixed
- Executes a query in the context of this transaction.
- remove() : void
- Removes a document from a collection.
- replace() : TransactionGetResult
- Replaces a document in a collection
Properties
$transaction
private
resource
$transaction
Methods
get()
Retrieves the value of a document from the collection.
public
get(Collection $collection, string $id[, TransactionGetOptions|null $options = null ]) : TransactionGetResult
Parameters
- $collection : Collection
-
The collection the document lives in.
- $id : string
-
The document key to retrieve.
- $options : TransactionGetOptions|null = null
-
The options to use for the operation
Tags
Return values
TransactionGetResult —getMulti()
Retrieves a group of documents.
public
getMulti(array<string|int, TransactionGetMultiSpec> $specs[, TransactionGetMultiOptions|null $options = null ]) : TransactionGetMultiResult
Parameters
- $specs : array<string|int, TransactionGetMultiSpec>
-
The specs describing each entry to fetch
- $options : TransactionGetMultiOptions|null = null
-
The options to use for the operation
Tags
Return values
TransactionGetMultiResult —result that contains set of the documents.
getMultiReplicasFromPreferredServerGroup()
Retrieves a group of documents, but give priority to copies from preferred server group.
public
getMultiReplicasFromPreferredServerGroup(array<string|int, TransactionGetMultiReplicasFromPreferredServerGroupSpec> $specs[, TransactionGetMultiReplicasFromPreferredServerGroupOptions|null $options = null ]) : TransactionGetMultiReplicasFromPreferredServerGroupResult
Parameters
- $specs : array<string|int, TransactionGetMultiReplicasFromPreferredServerGroupSpec>
-
The specs describing each entry to fetch
- $options : TransactionGetMultiReplicasFromPreferredServerGroupOptions|null = null
-
The options to use for the operation
Tags
Return values
TransactionGetMultiReplicasFromPreferredServerGroupResult —result that contains set of the documents.
getReplicaFromPreferredServerGroup()
Get a document copy from the selected server group.
public
getReplicaFromPreferredServerGroup(Collection $collection, string $id[, TransactionGetReplicaOptions|null $options = null ]) : TransactionGetResult
Fetch the document contents, in the form of a @ref transaction_get_result. It might be either replica or active copy of the document. One of the use cases for this method is to save on network costs by deploying SDK in the same availability zone as corresponding server group of the nodes.
Parameters
- $collection : Collection
-
The collection the document lives in.
- $id : string
-
The document key to retrieve
- $options : TransactionGetReplicaOptions|null = null
-
The options to use for the operation
Tags
Return values
TransactionGetResult —insert()
Inserts a new document to the collection, failing if the document already exists.
public
insert(Collection $collection, string $id, mixed $value[, TransactionInsertOptions|null $options = null ]) : TransactionGetResult
Parameters
- $collection : Collection
-
The collection the document lives in.
- $id : string
-
The document key to insert.
- $value : mixed
-
the document content to insert
- $options : TransactionInsertOptions|null = null
-
The options to use for the operation
Tags
Return values
TransactionGetResult —query()
Executes a query in the context of this transaction.
public
query(string $statement[, TransactionQueryOptions|null $options = null ]) : mixed
Parameters
- $statement : string
- $options : TransactionQueryOptions|null = null
Tags
Return values
mixed —remove()
Removes a document from a collection.
public
remove(TransactionGetResult $document) : void
Parameters
- $document : TransactionGetResult
Tags
Return values
void —replace()
Replaces a document in a collection
public
replace(TransactionGetResult $document, mixed $value[, TransactionReplaceOptions|null $options = null ]) : TransactionGetResult
Parameters
- $document : TransactionGetResult
-
the document to replace
- $value : mixed
-
the document content to replace
- $options : TransactionReplaceOptions|null = null
-
The options to use for the operation