Documentation

ScopedContextInterface extends WorkflowContextInterface

Handles scope creation.

Table of Contents

Methods

allHandlersFinished()  : bool
Whether update and signal handlers have finished executing.
async()  : CancellationScopeInterface
The method calls an asynchronous task and returns a promise.
asyncDetached()  : CancellationScopeInterface
Cancellation scope which does not react to parent cancel and completes in background.
await()  : PromiseInterface
Moves to the next step if the expression evaluates to `true`.
awaitWithTimeout()  : PromiseInterface<string|int, bool>
Checks if any conditions were met or the timeout was reached.
continueAsNew()  : PromiseInterface
Completes the current workflow execution atomically and starts a new execution with the same Workflow Id.
executeActivity()  : PromiseInterface<string|int, mixed>
Calls an activity by its name and gets the result of its execution.
executeChildWorkflow()  : PromiseInterface
Calls an external workflow without stopping the current one.
getInfo()  : WorkflowInfo
Returns information about current workflow execution.
getInput()  : ValuesInterface
Returns workflow execution input arguments.
getLastCompletionResult()  : mixed
Get value of last completion result, if any.
getStackTrace()  : string
Returns a complete trace of the last calls (for debugging).
getVersion()  : PromiseInterface
Updates the behavior of an existing workflow to resolve inconsistency errors during replay.
isReplaying()  : bool
newActivityStub()  : T
The method returns a proxy over the class containing the activity, which allows you to conveniently and beautifully call all methods within the passed class.
newChildWorkflowStub()  : T
Creates a proxy for a workflow class to execute as a child workflow.
newContinueAsNewStub()  : T
Creates client stub that can be used to continue this workflow as new.
newExternalWorkflowStub()  : T
Creates client stub that can be used to communicate to an existing workflow execution.
newUntypedActivityStub()  : ActivityStubInterface
The method creates and returns a proxy class with the specified settings that allows to call an activities with the passed options.
newUntypedChildWorkflowStub()  : ChildWorkflowStubInterface
Creates a proxy for a workflow by name to execute as a child workflow.
newUntypedExternalWorkflowStub()  : ExternalWorkflowStubInterface
Creates untyped client stub that can be used to signal or cancel a child workflow.
now()  : DateTimeInterface
registerQuery()  : $this
A method that allows you to dynamically register additional query handler in a workflow during the execution of a workflow.
registerSignal()  : $this
Registers a query with an additional signal handler.
registerUpdate()  : static
Registers an update method with an optional validator.
sideEffect()  : PromiseInterface<string|int, TReturn>
Isolates non-pure data to ensure consistent results during workflow replays.
timer()  : PromiseInterface
Stops workflow execution work for a specified period.
upsertSearchAttributes()  : void
uuid()  : PromiseInterface<string|int, UuidInterface>
Generate a UUID.
uuid4()  : PromiseInterface<string|int, UuidInterface>
Generate a UUID version 4 (random).
uuid7()  : PromiseInterface<string|int, UuidInterface>
Generate a UUID version 7 (Unix Epoch time).

Methods

allHandlersFinished()

Whether update and signal handlers have finished executing.

public allHandlersFinished() : bool

Consider waiting on this condition before workflow return or continue-as-new, to prevent interruption of in-progress handlers by workflow exit:

yield Workflow.await(static fn() => Workflow::allHandlersFinished());
Return values
bool

True if all handlers have finished executing.

await()

Moves to the next step if the expression evaluates to `true`.

public await(callable|Mutex|PromiseInterface ...$conditions) : PromiseInterface
Parameters
$conditions : callable|Mutex|PromiseInterface
Tags
see
Workflow::await()
Return values
PromiseInterface

awaitWithTimeout()

Checks if any conditions were met or the timeout was reached.

public awaitWithTimeout(DateIntervalValue $interval, callable|Mutex|PromiseInterface ...$conditions) : PromiseInterface<string|int, bool>

Returns true if any of conditions were fired and false if timeout was reached.

Parameters
$interval : DateIntervalValue
$conditions : callable|Mutex|PromiseInterface
Tags
see
Workflow::awaitWithTimeout()
Return values
PromiseInterface<string|int, bool>

continueAsNew()

Completes the current workflow execution atomically and starts a new execution with the same Workflow Id.

public continueAsNew(string $type[, array<string|int, mixed> $args = [] ][, ContinueAsNewOptions|null $options = null ]) : PromiseInterface
Parameters
$type : string
$args : array<string|int, mixed> = []
$options : ContinueAsNewOptions|null = null
Tags
see
Workflow::continueAsNew()
Return values
PromiseInterface

executeActivity()

Calls an activity by its name and gets the result of its execution.

public executeActivity(string $type[, array<string|int, mixed> $args = [] ][, ActivityOptions|null $options = null ][, Type|string|ReflectionClass|ReflectionType|null $returnType = null ]) : PromiseInterface<string|int, mixed>
Parameters
$type : string
$args : array<string|int, mixed> = []
$options : ActivityOptions|null = null
$returnType : Type|string|ReflectionClass|ReflectionType|null = null
Tags
see
Workflow::executeActivity()
Return values
PromiseInterface<string|int, mixed>

executeChildWorkflow()

Calls an external workflow without stopping the current one.

public executeChildWorkflow(string $type[, array<string|int, mixed> $args = [] ][, ChildWorkflowOptions|null $options = null ][, Type|string|ReflectionType|ReflectionClass|null $returnType = null ]) : PromiseInterface
Parameters
$type : string
$args : array<string|int, mixed> = []
$options : ChildWorkflowOptions|null = null
$returnType : Type|string|ReflectionType|ReflectionClass|null = null
Tags
see
Workflow::executeChildWorkflow()
Return values
PromiseInterface

getVersion()

Updates the behavior of an existing workflow to resolve inconsistency errors during replay.

public getVersion(string $changeId, int $minSupported, int $maxSupported) : PromiseInterface
Parameters
$changeId : string
$minSupported : int
$maxSupported : int
Tags
see
Workflow::getVersion()
Return values
PromiseInterface

registerQuery()

A method that allows you to dynamically register additional query handler in a workflow during the execution of a workflow.

public registerQuery(string $queryType, callable $handler) : $this
Parameters
$queryType : string
$handler : callable
Tags
see
Workflow::registerQuery()
Return values
$this

registerSignal()

Registers a query with an additional signal handler.

public registerSignal(string $queryType, callable $handler) : $this
Parameters
$queryType : string
$handler : callable
Tags
see
Workflow::registerSignal()
Return values
$this

registerUpdate()

Registers an update method with an optional validator.

public registerUpdate(non-empty-string $name, callable $handler, callable|null $validator) : static
Parameters
$name : non-empty-string
$handler : callable
$validator : callable|null
Tags
see
Workflow::registerUpdate()
Return values
static

sideEffect()

Isolates non-pure data to ensure consistent results during workflow replays.

public sideEffect(callable(): TReturn $context) : PromiseInterface<string|int, TReturn>
Parameters
$context : callable(): TReturn
Tags
see
Workflow::sideEffect()
template

TReturn

Return values
PromiseInterface<string|int, TReturn>

timer()

Stops workflow execution work for a specified period.

public timer(DateIntervalValue $interval) : PromiseInterface
Parameters
$interval : DateIntervalValue
Tags
see
Workflow::timer()
see
DateInterval
Return values
PromiseInterface

upsertSearchAttributes()

public upsertSearchAttributes(array<string, mixed> $searchAttributes) : void
Parameters
$searchAttributes : array<string, mixed>

uuid4()

Generate a UUID version 4 (random).

public uuid4() : PromiseInterface<string|int, UuidInterface>
Tags
see
Workflow::uuid4()
Return values
PromiseInterface<string|int, UuidInterface>

uuid7()

Generate a UUID version 7 (Unix Epoch time).

public uuid7([DateTimeInterface|null $dateTime = null ]) : PromiseInterface<string|int, UuidInterface>
Parameters
$dateTime : DateTimeInterface|null = null

An optional date/time from which to create the version 7 UUID. If not provided, the UUID is generated using the current date/time.

Tags
see
Workflow::uuid7()
Return values
PromiseInterface<string|int, UuidInterface>

        
On this page

Search results