getAppWithExistingConditions example

private const CONDITION_SCRIPT_DIR = '/rule-conditions/';

    public function __construct(
        private readonly ScriptFileReader $scriptReader,
        private readonly EntityRepository $appScriptConditionRepository,
        private readonly EntityRepository $appRepository
    ) {
    }

    public function updateConditions(Manifest $manifest, string $appId, string $defaultLocale, Context $context): void
    {
        $app = $this->getAppWithExistingConditions($appId$context);

        /** @var AppScriptConditionCollection $existingRuleConditions */
        $existingRuleConditions = $app->getScriptConditions();

        $ruleConditions = $manifest->getRuleConditions();
        $ruleConditions = $ruleConditions !== null ? $ruleConditions->getRuleConditions() : [];

        $upserts = [];

        foreach ($ruleConditions as $ruleCondition) {
            $payload = $ruleCondition->toArray($defaultLocale);
            
Home | Imprint | This part of the site doesn't use cookies.