getAppScriptCondition example


    private function setScriptConstraints(
        ScriptRule $ruleInstance,
        ?RuleConditionEntity $condition,
        array $payload,
        Context $context
    ): void {
        $script = null;
        if (isset($payload['script_id'])) {
            $scriptId = Uuid::fromBytesToHex($payload['script_id']);
            $script = $this->appScriptConditionRepository->search(new Criteria([$scriptId])$context)->get($scriptId);
        } elseif ($condition && $condition->getAppScriptCondition()) {
            $script = $condition->getAppScriptCondition();
        }

        if (!$script instanceof AppScriptConditionEntity || !\is_array($script->getConstraints())) {
            return;
        }

        $ruleInstance->setConstraints($script->getConstraints());
    }
}
Home | Imprint | This part of the site doesn't use cookies.