@@ -69,11 +69,6 @@ public function create(ActionCreate $action, UserContext $context): int
6969 $ parameters = new Parameters ($ config );
7070 $ handler = $ this ->newAction ($ class );
7171
72- // call lifecycle
73- if ($ handler instanceof LifecycleInterface) {
74- $ handler ->onCreate ($ name , $ parameters );
75- }
76-
7772 // create action
7873 try {
7974 $ this ->actionTable ->beginTransaction ();
@@ -93,7 +88,12 @@ public function create(ActionCreate $action, UserContext $context): int
9388 $ actionId = $ this ->actionTable ->getLastInsertId ();
9489 $ action ->setId ($ actionId );
9590
96- $ this ->actionCommitter ->commit ($ actionId , $ row ->getConfig (), $ context );
91+ $ hash = $ this ->actionCommitter ->commit ($ actionId , $ row ->getConfig (), $ context );
92+
93+ // call lifecycle
94+ if ($ handler instanceof LifecycleInterface) {
95+ $ handler ->onCreate ($ name , $ parameters , $ hash );
96+ }
9797
9898 $ this ->actionTable ->commit ();
9999 } catch (Throwable $ e ) {
@@ -128,11 +128,6 @@ public function update(string $actionId, ActionUpdate $action, UserContext $cont
128128 $ parameters = new Parameters ($ config ?? []);
129129 $ handler = $ this ->newAction ($ class );
130130
131- // call lifecycle
132- if ($ handler instanceof LifecycleInterface) {
133- $ handler ->onUpdate ($ name , $ parameters );
134- }
135-
136131 // update action
137132 try {
138133 $ this ->actionTable ->beginTransaction ();
@@ -145,7 +140,12 @@ public function update(string $actionId, ActionUpdate $action, UserContext $cont
145140 $ existing ->setDate (LocalDateTime::now ());
146141 $ this ->actionTable ->update ($ existing );
147142
148- $ this ->actionCommitter ->commit ($ existing ->getId (), $ existing ->getConfig (), $ context );
143+ $ hash = $ this ->actionCommitter ->commit ($ existing ->getId (), $ existing ->getConfig (), $ context );
144+
145+ // call lifecycle
146+ if ($ handler instanceof LifecycleInterface) {
147+ $ handler ->onUpdate ($ name , $ parameters , $ hash );
148+ }
149149
150150 $ this ->actionTable ->commit ();
151151 } catch (Throwable $ e ) {
0 commit comments