Skip to content

Commit

Permalink
Task add finally handler after canceled
Browse files Browse the repository at this point in the history
  • Loading branch information
kuaukutsu committed Mar 25, 2024
1 parent 6352091 commit 6115524
Showing 1 changed file with 11 additions and 1 deletion.
12 changes: 11 additions & 1 deletion src/service/action/ActionCancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
use kuaukutsu\poc\task\dto\StageModelState;
use kuaukutsu\poc\task\dto\TaskModelState;
use kuaukutsu\poc\task\handler\TaskFactory;
use kuaukutsu\poc\task\handler\TaskFinallyHandler;
use kuaukutsu\poc\task\service\StageCommand;
use kuaukutsu\poc\task\service\TaskCommand;
use kuaukutsu\poc\task\state\TaskStateError;
Expand All @@ -23,6 +24,7 @@ public function __construct(
private StageCommand $stageCommand,
private TaskCommand $taskCommand,
private TaskFactory $factory,
private TaskFinallyHandler $finallyHandler,
private TransitionState $transition,
) {
}
Expand Down Expand Up @@ -55,8 +57,16 @@ public function execute(EntityTask $task, ?TaskStateInterface $state = null): En
);
}

return $this->factory->create(
$task = $this->factory->create(
$this->taskCommand->state($uuid, new TaskModelState($state))
);

$this->finallyHandler->handle(
$task->getUuid(),
$task->getOptions(),
$task->getState(),
);

return $task;
}
}

0 comments on commit 6115524

Please sign in to comment.