triggerFound = false; } public function visitNode(Workflow $workflow, WorkflowNode $node): void { if ($node->getStep()->getType() === Step::TYPE_TRIGGER) { $this->triggerFound = true; } } public function complete(Workflow $workflow): void { // do not validate for drafts if ($workflow->getStatus() === Workflow::STATUS_DRAFT) { return; } if ($this->triggerFound) { return; } throw Exceptions::workflowStructureNotValid(__('There must be at least one trigger in the automation.', 'mailpoet'), self::RULE_ID); } }