You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/features/child-workflows.md
+111Lines changed: 111 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -21,6 +21,117 @@ class ParentWorkflow extends Workflow
21
21
}
22
22
```
23
23
24
+
## Signaling Child Workflows
25
+
26
+
Parent workflows can signal their child workflows to coordinate behavior or pass data. To signal a child safely without corrupting the parent's execution context, use the `child()` or `children()` methods.
27
+
28
+
### Getting a Child Handle
29
+
30
+
The `child()` method returns a `ChildWorkflowHandle` for the most recently created child workflow:
Always call `$this->child()` or `$this->children()` in the `execute()` method. Never call these methods in signal methods or query methods, as this violates determinism during workflow replay.
126
+
127
+
### Getting Child Workflow IDs
128
+
129
+
You can access the underlying stored workflow ID using the `id()` method. This allows you to store the ID for external systems to signal the child directly.
Rather than creating a child workflow, you can pass a callback to `ActivityStub::async()` and it will be executed in the context of a separate workflow.
0 commit comments