Use step run args in existing actions

[MAILPOET-4629]
This commit is contained in:
Jan Jakes
2022-09-19 13:57:15 +02:00
committed by David Remer
parent 68b5bab9cc
commit fe3d719a13
5 changed files with 71 additions and 54 deletions

View File

@@ -4,8 +4,8 @@ namespace MailPoet\Automation\Integrations\Core\Actions;
use MailPoet\Automation\Engine\Control\ActionScheduler;
use MailPoet\Automation\Engine\Data\Step;
use MailPoet\Automation\Engine\Data\StepRunArgs;
use MailPoet\Automation\Engine\Data\Workflow;
use MailPoet\Automation\Engine\Data\WorkflowRun;
use MailPoet\Automation\Engine\Hooks;
use MailPoet\Automation\Engine\Workflows\Action;
use MailPoet\Validator\Builder;
@@ -40,11 +40,12 @@ class DelayAction implements Action {
return [];
}
public function run(Workflow $workflow, WorkflowRun $workflowRun, Step $step): void {
public function run(StepRunArgs $args): void {
$step = $args->getStep();
$nextStep = $step->getNextSteps()[0] ?? null;
$this->actionScheduler->schedule(time() + $this->calculateSeconds($step), Hooks::WORKFLOW_STEP, [
[
'workflow_run_id' => $workflowRun->getId(),
'workflow_run_id' => $args->getWorkflowRun()->getId(),
'step_id' => $nextStep ? $nextStep->getId() : null,
],
]);