Introduce step run args to simplify step run arguments

[MAILPOET-4629]
This commit is contained in:
Jan Jakes
2022-09-19 13:52:12 +02:00
committed by David Remer
parent 460cbd9e12
commit 68b5bab9cc
6 changed files with 80 additions and 23 deletions

View File

@ -5,6 +5,7 @@ namespace MailPoet\Automation\Engine\Control;
use Exception;
use MailPoet\Automation\Engine\Control\Steps\ActionStepRunner;
use MailPoet\Automation\Engine\Data\Step;
use MailPoet\Automation\Engine\Data\StepRunArgs;
use MailPoet\Automation\Engine\Data\SubjectEntry;
use MailPoet\Automation\Engine\Data\WorkflowRun;
use MailPoet\Automation\Engine\Data\WorkflowRunLog;
@ -133,7 +134,8 @@ class StepHandler {
try {
$requiredSubjects = $step instanceof Action ? $step->getSubjectKeys() : [];
$subjectEntries = $this->getSubjectEntries($workflowRun, $requiredSubjects);
$this->stepRunners[$stepType]->run($workflow, $workflowRun, $step, $subjectEntries);
$args = new StepRunArgs($workflow, $workflowRun, $step, $subjectEntries);
$this->stepRunners[$stepType]->run($args);
$log->markCompletedSuccessfully();
} catch (Throwable $e) {
$log->markFailed();