Early return when no active automation matches given trigger

[MAILPOET-4946]
This commit is contained in:
Jan Jakes
2023-03-31 11:26:04 +02:00
committed by Aschepikov
parent d99a7bca90
commit 70dbfc28b7

View File

@@ -59,8 +59,12 @@ class TriggerHandler {
/** @param Subject[] $subjects */
public function processTrigger(Trigger $trigger, array $subjects): void {
$subjects = $this->subjectTransformerHandler->getAllSubjects($subjects);
$automations = $this->automationStorage->getActiveAutomationsByTrigger($trigger);
if (!$automations) {
return;
}
$subjects = $this->subjectTransformerHandler->getAllSubjects($subjects);
foreach ($automations as $automation) {
$step = $automation->getTrigger($trigger->getKey());
if (!$step) {