WorkflowContextInterface
extends
EnvironmentInterface
in
Tags
Table of Contents
Methods
- allHandlersFinished() : bool
- Whether update and signal handlers have finished executing.
- 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
Return values
PromiseInterfaceawaitWithTimeout()
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
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
Return values
PromiseInterfaceexecuteActivity()
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|null|ReflectionClass|ReflectionType $returnType = null ]) : PromiseInterface<string|int, mixed>
Parameters
- $type : string
- $args : array<string|int, mixed> = []
- $options : ActivityOptions|null = null
- $returnType : Type|string|null|ReflectionClass|ReflectionType = null
Tags
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
Return values
PromiseInterfacegetInfo()
Returns information about current workflow execution.
public
getInfo() : WorkflowInfo
Tags
Return values
WorkflowInfogetInput()
Returns workflow execution input arguments.
public
getInput() : ValuesInterface
Tags
Return values
ValuesInterfacegetLastCompletionResult()
Get value of last completion result, if any.
public
getLastCompletionResult([Type|string|null $type = null ]) : mixed
Parameters
- $type : Type|string|null = null
Tags
getStackTrace()
Returns a complete trace of the last calls (for debugging).
public
getStackTrace() : string
Tags
Return values
stringgetVersion()
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
Return values
PromiseInterfaceisReplaying()
public
isReplaying() : bool
Return values
boolnewActivityStub()
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.
public
newActivityStub(T> $class[, ActivityOptionsInterface|null $options = null ]) : T
Parameters
- $class : T>
- $options : ActivityOptionsInterface|null = null
Tags
Return values
TnewChildWorkflowStub()
Creates a proxy for a workflow class to execute as a child workflow.
public
newChildWorkflowStub(T> $class[, ChildWorkflowOptions|null $options = null ]) : T
Parameters
- $class : T>
- $options : ChildWorkflowOptions|null = null
Tags
Return values
TnewContinueAsNewStub()
Creates client stub that can be used to continue this workflow as new.
public
newContinueAsNewStub(T> $class[, ContinueAsNewOptions|null $options = null ]) : T
Parameters
- $class : T>
- $options : ContinueAsNewOptions|null = null
Tags
Return values
TnewExternalWorkflowStub()
Creates client stub that can be used to communicate to an existing workflow execution.
public
newExternalWorkflowStub(T> $class, WorkflowExecution $execution) : T
Parameters
- $class : T>
- $execution : WorkflowExecution
Tags
Return values
TnewUntypedActivityStub()
The method creates and returns a proxy class with the specified settings that allows to call an activities with the passed options.
public
newUntypedActivityStub([ActivityOptionsInterface|null $options = null ]) : ActivityStubInterface
Parameters
- $options : ActivityOptionsInterface|null = null
Tags
Return values
ActivityStubInterfacenewUntypedChildWorkflowStub()
Creates a proxy for a workflow by name to execute as a child workflow.
public
newUntypedChildWorkflowStub(string $type[, ChildWorkflowOptions|null $options = null ]) : ChildWorkflowStubInterface
Parameters
- $type : string
- $options : ChildWorkflowOptions|null = null
Tags
Return values
ChildWorkflowStubInterfacenewUntypedExternalWorkflowStub()
Creates untyped client stub that can be used to signal or cancel a child workflow.
public
newUntypedExternalWorkflowStub(WorkflowExecution $execution) : ExternalWorkflowStubInterface
Parameters
- $execution : WorkflowExecution
Tags
Return values
ExternalWorkflowStubInterfacenow()
public
now() : DateTimeInterface
Return values
DateTimeInterfaceregisterQuery()
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
Return values
$thisregisterSignal()
Registers a query with an additional signal handler.
public
registerSignal(string $queryType, callable $handler) : $this
Parameters
- $queryType : string
- $handler : callable
Tags
Return values
$thisregisterUpdate()
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
Return values
staticsideEffect()
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
Return values
PromiseInterface<string|int, TReturn>timer()
Stops workflow execution work for a specified period.
public
timer(DateIntervalValue $interval) : PromiseInterface
Parameters
- $interval : DateIntervalValue
Tags
Return values
PromiseInterfaceupsertSearchAttributes()
public
upsertSearchAttributes(array<string, mixed> $searchAttributes) : void
Parameters
- $searchAttributes : array<string, mixed>
uuid()
Generate a UUID.
public
uuid() : PromiseInterface<string|int, UuidInterface>
Tags
Return values
PromiseInterface<string|int, UuidInterface>uuid4()
Generate a UUID version 4 (random).
public
uuid4() : PromiseInterface<string|int, UuidInterface>
Tags
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.