File tree Expand file tree Collapse file tree 3 files changed +16
-6
lines changed
Expand file tree Collapse file tree 3 files changed +16
-6
lines changed Original file line number Diff line number Diff line change @@ -105,6 +105,12 @@ final class WorkflowInfo
105105 #[Marshal(name: 'ParentWorkflowNamespace ' )]
106106 public ?string $ parentNamespace = null ;
107107
108+ /**
109+ * @since SDK 2.16.0
110+ */
111+ #[Marshal(name: 'RootWorkflowExecution ' , type: NullableType::class, of: WorkflowExecution::class)]
112+ public ?WorkflowExecution $ rootExecution = null ;
113+
108114 #[Marshal(name: 'ParentWorkflowExecution ' , type: NullableType::class, of: WorkflowExecution::class)]
109115 public ?WorkflowExecution $ parentExecution = null ;
110116
Original file line number Diff line number Diff line change @@ -17,8 +17,11 @@ class RootWorkflowExecutionTest extends TestCase
1717 #[Test]
1818 public static function check (#[Stub('Extra_Workflow_RootWorkflowExecution ' )]WorkflowStubInterface $ stub ): void
1919 {
20- self ::markTestSkipped ('Waiting https://github.com/temporalio/sdk-go/issues/1848 ' );
21- self ::assertSame ('Test ' , $ stub ->getResult ());
20+ $ result = $ stub ->getResult (type: 'array ' );
21+ self ::assertSame ([
22+ 'ID ' => $ stub ->getExecution ()->getID (),
23+ 'RunID ' => $ stub ->getExecution ()->getRunID (),
24+ ], $ result );
2225 }
2326}
2427
@@ -37,19 +40,19 @@ public function run()
3740class ChildWorkflow
3841{
3942 #[WorkflowMethod('Extra_Workflow_RootWorkflowExecution_Child ' )]
40- public function run (string $ input )
43+ public function run ()
4144 {
4245 return yield Workflow::newChildWorkflowStub (ChildWorkflow2::class)
43- ->run ($ input );
46+ ->run ();
4447 }
4548}
4649
4750#[WorkflowInterface]
4851class ChildWorkflow2
4952{
5053 #[WorkflowMethod('Extra_Workflow_RootWorkflowExecution_Child2 ' )]
51- public function run (string $ input )
54+ public function run ()
5255 {
53- return $ input ;
56+ return Workflow:: getCurrentContext ()-> getInfo ()-> rootExecution ;
5457 }
5558}
Original file line number Diff line number Diff line change @@ -42,6 +42,7 @@ public function testMarshalling(): void
4242 'CronSchedule ' => null ,
4343 'ContinuedExecutionRunID ' => null ,
4444 'ParentWorkflowNamespace ' => null ,
45+ 'RootWorkflowExecution ' => null ,
4546 'ParentWorkflowExecution ' => null ,
4647 'SearchAttributes ' => null ,
4748 'TypedSearchAttributes ' => [],
You can’t perform that action at this time.
0 commit comments