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.
- getInstance() : object
- Get the currently running Workflow instance.
- getLastCompletionResult() : mixed
- Get value of last completion result, if any.
- getLogger() : LoggerInterface
- Get logger to use inside the Workflow.
- 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
- registerDynamicQuery() : $this
- Registers a dynamic Query handler.
- registerDynamicSignal() : $this
- Registers a dynamic Signal handler.
- registerDynamicUpdate() : $this
- Registers a dynamic Update handler.
- 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.
- upsertMemo() : void
- Updates this Workflow's Memos by merging the provided memo with existing Memos.
- upsertSearchAttributes() : void
- Upsert search attributes
- upsertTypedSearchAttributes() : void
- Upsert typed Search Attributes
- 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|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
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
ValuesInterfacegetInstance()
Get the currently running Workflow instance.
    public
                    getInstance() : object
    Return values
objectgetLastCompletionResult()
Get value of last completion result, if any.
    public
                    getLastCompletionResult([Type|string|null $type = null ]) : mixed
    Parameters
- $type : Type|string|null = null
Tags
getLogger()
Get logger to use inside the Workflow.
    public
                    getLogger() : LoggerInterface
    Logs in replay mode are omitted unless WorkerOptions::$enableLoggingInReplay is set to true.
Return values
LoggerInterfacegetStackTrace()
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
DateTimeInterfaceregisterDynamicQuery()
Registers a dynamic Query handler.
    public
                    registerDynamicQuery(callable(non-empty-string, ValuesInterface): mixed $handler) : $this
    Parameters
- $handler : callable(non-empty-string, ValuesInterface): mixed
- 
                    The handler to call when a Query is received. The first parameter is the Query name, the second is Query arguments. 
Tags
Return values
$thisregisterDynamicSignal()
Registers a dynamic Signal handler.
    public
                    registerDynamicSignal(callable(non-empty-string, ValuesInterface): mixed $handler) : $this
    Parameters
- $handler : callable(non-empty-string, ValuesInterface): mixed
- 
                    The handler to call when a Signal is received. The first parameter is the Signal name, the second is Signal arguments. 
Tags
Return values
$thisregisterDynamicUpdate()
Registers a dynamic Update handler.
    public
                    registerDynamicUpdate(callable(non-empty-string, ValuesInterface): mixed $handler[, null|callable(non-empty-string, ValuesInterface): mixed $validator = null ]) : $this
    Parameters
- $handler : callable(non-empty-string, ValuesInterface): mixed
- 
                    The Update handler The first parameter is the Update name, the second is Update arguments. 
- $validator : null|callable(non-empty-string, ValuesInterface): mixed = null
- 
                    The Update validator The first parameter is the Update name, the second is Update arguments. It should throw an exception if the validation fails. 
Tags
Return values
$thisregisterQuery()
A method that allows you to dynamically register additional query handler in a workflow during the execution of a workflow.
    public
                    registerQuery(non-empty-string $queryType, callable $handler, string $description) : $this
    Parameters
- $queryType : non-empty-string
- $handler : callable
- $description : string
Tags
Return values
$thisregisterSignal()
Registers a query with an additional signal handler.
    public
                    registerSignal(non-empty-string $queryType, callable $handler, string $description) : $this
    Parameters
- $queryType : non-empty-string
- $handler : callable
- $description : string
Tags
Return values
$thisregisterUpdate()
Registers an Update method with an optional validator.
    public
                    registerUpdate(non-empty-string $name, callable $handler, callable|null $validator, string $description) : static
    Parameters
- $name : non-empty-string
- $handler : callable
- $validator : callable|null
- $description : string
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[, TimerOptions|null $options = null ]) : PromiseInterface
    Parameters
- $interval : DateIntervalValue
- $options : TimerOptions|null = null
Tags
Return values
PromiseInterfaceupsertMemo()
Updates this Workflow's Memos by merging the provided memo with existing Memos.
    public
                    upsertMemo(array<non-empty-string, mixed> $values) : void
    New Memo is merged by replacing properties of the same name at the first level only. Setting a property to null clears that key from the Memo.
For example:
 Workflow::upsertMemo([
     'key1' => 'value',
     'key3' => ['subkey1' => 'value']
     'key4' => 'value',
 });
 Workflow::upsertMemo([
     'key2' => 'value',
     'key3' => ['subkey2' => 'value']
     'key4' => null,
 ]);
would result in the Workflow having these Memo:
 [
     'key1' => 'value',
     'key2' => 'value',
     'key3' => ['subkey2' => 'value'], // Note this object was completely replaced
     // Note that 'key4' was completely removed
 ]
Parameters
- $values : array<non-empty-string, mixed>
Tags
upsertSearchAttributes()
Upsert search attributes
    public
                    upsertSearchAttributes(array<non-empty-string, mixed> $searchAttributes) : void
    Parameters
- $searchAttributes : array<non-empty-string, mixed>
upsertTypedSearchAttributes()
Upsert typed Search Attributes
    public
                    upsertTypedSearchAttributes(SearchAttributeUpdate ...$updates) : void
     Workflow::upsertTypedSearchAttributes(
     SearchAttributeKey::forKeyword('CustomKeyword')->valueSet('CustomValue'),
     SearchAttributeKey::forInt('MyCounter')->valueSet(42),
 );
Parameters
- $updates : SearchAttributeUpdate
Tags
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.