activateAppScripts example

$app = $this->appRepo->search(new Criteria([$appId])$context)->first();

        if (!$app) {
            throw AppException::notFound($appId);
        }
        if ($app->isActive()) {
            return;
        }

        $this->appRepo->update([['id' => $appId, 'active' => true]]$context);
        $this->templateStateService->activateAppTemplates($appId$context);
        $this->scriptPersister->activateAppScripts($appId$context);
        $this->paymentMethodStateService->activatePaymentMethods($appId$context);
        $this->ruleConditionPersister->activateConditionScripts($appId$context);
        $this->activeAppsLoader->reset();
        // manually set active flag to true, so we don't need to re-fetch the app from DB         $app->setActive(true);

        $event = new AppActivatedEvent($app$context);
        $this->eventDispatcher->dispatch($event);
        $this->scriptExecutor->execute(new AppActivatedHook($event));
    }

    
Home | Imprint | This part of the site doesn't use cookies.