Use step args for triggers

[MAILPOET-4629]
This commit is contained in:
Jan Jakes
2022-09-22 13:20:08 +02:00
committed by David Remer
parent a7a58ee791
commit 5920810ac6
6 changed files with 37 additions and 60 deletions

View File

@@ -2,6 +2,7 @@
namespace MailPoet\Automation\Engine\Control;
use MailPoet\Automation\Engine\Data\StepRunArgs;
use MailPoet\Automation\Engine\Data\Subject;
use MailPoet\Automation\Engine\Data\WorkflowRun;
use MailPoet\Automation\Engine\Exceptions;
@@ -60,11 +61,11 @@ class TriggerHandler {
$entry->getPayload();
}
if (!$trigger->isTriggeredBy($step->getArgs(), $subjectEntries)) {
$workflowRun = new WorkflowRun($workflow->getId(), $workflow->getVersionId(), $trigger->getKey(), $subjects);
if (!$trigger->isTriggeredBy(new StepRunArgs($workflow, $workflowRun, $step, $subjectEntries))) {
return;
}
$workflowRun = new WorkflowRun($workflow->getId(), $workflow->getVersionId(), $trigger->getKey(), $subjects);
$workflowRunId = $this->workflowRunStorage->createWorkflowRun($workflowRun);
$nextStep = $step->getNextSteps()[0] ?? null;
$this->actionScheduler->enqueue(Hooks::WORKFLOW_STEP, [