Since: 1.4.0

final class Session (View source)

Class Session

Constants

TRANSACTION_NONE Since: 1.7.0

TRANSACTION_STARTING Since: 1.7.0

TRANSACTION_IN_PROGRESS Since: 1.7.0

TRANSACTION_COMMITTED Since: 1.7.0

TRANSACTION_ABORTED Since: 1.7.0

Methods

__wakeup()

No description

void
abortTransaction()

Aborts a transaction

void
advanceClusterTime(array|object $clusterTime)

Advances the cluster time for this session

void
advanceOperationTime(TimestampInterface $operationTime)

Advances the operation time for this session

void
commitTransaction()

No description

void
endSession()

This method closes an existing session. If a transaction was associated with this session, this transaction is also aborted, and all its operations are rolled back.

object|null
getClusterTime()

Returns the cluster time for this session

object
getLogicalSessionId()

Returns the logical session ID for this session

Timestamp|null
getOperationTime()

Returns the operation time for this session, or NULL if the session has no operation time

Server|null
getServer()

Returns the server to which this session is pinned, or NULL if the session is not pinned to any server.

array|null
getTransactionOptions()

Returns options for the current transactions, or NULL if no transaction is running.

string
getTransactionState()

Returns the current transaction state

bool
isDirty()

Returns whether the session has been marked as dirty

bool
isInTransaction()

Returns whether a multi-document transaction is in progress.

void
startTransaction(array|null $options = null)

Starts a transaction

Details

final __wakeup()

No description

final void abortTransaction()

Since: 1.5.0

Aborts a transaction

Return Value

void

final void advanceClusterTime(array|object $clusterTime)

Since: 1.4.0

Advances the cluster time for this session

Parameters

array|object $clusterTime

The cluster time is a document containing a logical timestamp and server signature

Return Value

void

Exceptions

InvalidArgumentException

final void advanceOperationTime(TimestampInterface $operationTime)

Since: 1.4.0

Advances the operation time for this session

Parameters

TimestampInterface $operationTime

Return Value

void

Exceptions

InvalidArgumentException

final void commitTransaction()

Since: 1.5.0

No description

final void endSession()

Since: 1.5.0

This method closes an existing session. If a transaction was associated with this session, this transaction is also aborted, and all its operations are rolled back.

Return Value

void

Exceptions

InvalidArgumentException

final object|null getClusterTime()

Since: 1.4.0

Returns the cluster time for this session

Return Value

object|null

Exceptions

InvalidArgumentException

final object getLogicalSessionId()

Since: 1.4.0

Returns the logical session ID for this session

Return Value

object

Returns the logical session ID for this session

Exceptions

InvalidArgumentException

final Timestamp|null getOperationTime()

Since: 1.4.0

Returns the operation time for this session, or NULL if the session has no operation time

Return Value

Timestamp|null

Exceptions

InvalidArgumentException

final Server|null getServer()

Since: 1.6.0

Returns the server to which this session is pinned, or NULL if the session is not pinned to any server.

Return Value

Server|null

Exceptions

InvalidArgumentException

final array|null getTransactionOptions()

Since: 1.7.0

Returns options for the current transactions, or NULL if no transaction is running.

Return Value

array|null

Exceptions

InvalidArgumentException

final string getTransactionState()

Since: 1.7.0

Returns the current transaction state

Return Value

string

Exceptions

InvalidArgumentException

final bool isDirty()

Since: 1.13.0

Returns whether the session has been marked as dirty

Return Value

bool

final bool isInTransaction()

Since: 1.6.0

Returns whether a multi-document transaction is in progress.

Return Value

bool

Exceptions

InvalidArgumentException

final void startTransaction(array|null $options = null)

Since: 1.4.0

Starts a transaction

Parameters

array|null $options

Return Value

void

Exceptions

InvalidArgumentException
CommandException
RuntimeException