Add validation rule identifiers to exceptions and responses

[MAILPOET-4659]
This commit is contained in:
Jan Jakes
2022-10-06 13:44:29 +02:00
committed by Jan Jakeš
parent 9da204489d
commit 6638707282
9 changed files with 28 additions and 11 deletions

View File

@@ -9,6 +9,8 @@ use MailPoet\Automation\Engine\Validation\WorkflowGraph\WorkflowNode;
use MailPoet\Automation\Engine\Validation\WorkflowGraph\WorkflowNodeVisitor;
class TriggersUnderRootRule implements WorkflowNodeVisitor {
public const RULE_ID = 'triggers-under-root';
/** @var array<string, Step> $triggersMap */
private $triggersMap = [];
@@ -30,7 +32,7 @@ class TriggersUnderRootRule implements WorkflowNodeVisitor {
foreach ($step->getNextSteps() as $nextStep) {
$nextStepId = $nextStep->getId();
if (isset($this->triggersMap[$nextStepId])) {
throw Exceptions::workflowStructureNotValid(__('Trigger must be a direct descendant of workflow root', 'mailpoet'));
throw Exceptions::workflowStructureNotValid(__('Trigger must be a direct descendant of workflow root', 'mailpoet'), self::RULE_ID);
}
}
}