class PennantState implements ReplicableContext

Feature values held for the current coroutine.

Stores are shared by every request in the worker, so the values they memoize live here instead. Each request, job and child coroutine starts with its own values.

Constants

CONTEXT_KEY

The coroutine context key for this state.

Properties

array<string, array<string, array<string, array<string, array<string, mixed>>>>> $values

The values memoized by the store decorators, keyed by connection, store, partition, feature and scope.

array<string, array<string, array<string, array<string, mixed>>>> $arrayValues

The values held by array drivers, keyed by store, partition, feature and scope.

array<int, array<string, true>> $transactions

The connections whose memoized values are forgotten if an open transaction rolls back, keyed by the transaction record's object ID.

Methods

static PennantState
current()

Get the state of the current coroutine.

void
forgetOnRollback(DatabaseTransactionRecord $record, string $connection)

Forget the values memoized for the connection if the given transaction rolls back.

replicate()

Create the state for a copied coroutine context.

Details

at line 50
static PennantState current()

Get the state of the current coroutine.

Return Value

PennantState

at line 58
void forgetOnRollback(DatabaseTransactionRecord $record, string $connection)

Forget the values memoized for the connection if the given transaction rolls back.

Parameters

DatabaseTransactionRecord $record
string $connection

Return Value

void

at line 90
ReplicableContext replicate()

Create the state for a copied coroutine context.

The copy keeps the memoized and array values, except values for connections in an open transaction, which the copy can't see roll back. Transactions are never inherited.

Return Value

ReplicableContext