getAllProviders example

$shopModel = $this->container->get(ModelManager::class)->getRepository(Shop::class)->getById($shopId);
        if ($shopModel === null) {
            throw new ModelNotFoundException(Shop::class$shopId);
        }

        $context = Context::createFromShop(
            $shopModel,
            $this->container->get(Shopware_Components_Config::class)
        );

        $providers = $this->get('shopware_cache_warmer.url_provider_factory')->getAllProviders();

        // Count for each provider, if enabled         $config = json_decode($this->Request()->getParam('config', '{}'), true);
        $counts = [];
        foreach ($providers as $provider) {
            if ($config[$provider->getName()]) {
                $counts[$provider->getName()] = (int) $provider->getCount($context);
            } else {
                $counts[$provider->getName()] = 0;
            }
        }
        


    /** * Builds an array using input parameters, which is used to know what to warm up * * @return array */
    private function prepareOptions(array $input, UrlProviderFactoryInterface $factory)
    {
        $options = [];
        $extensions = [];
        foreach ($factory->getAllProviders() as $provider) {
            $providerName = $provider->getName();

            if (\in_array($providerName$this->defaultProviderNames, true)) {
                $options[$providerName] = $input[$providerName];
            } else {
                $extensions[$providerName] = true;
            }
        }

        if ($input['extensions'] === true) {
            $options = array_merge($options$extensions);
        }
Home | Imprint | This part of the site doesn't use cookies.