setCompileId example

unset($session->template);
            }
        } else {
            unset($session->template);
        }

        // Save upgrades         $this->get(ShopRegistrationServiceInterface::class)->registerShop($shop);

        if ($request->isSecure()) {
            $template = $this->get(Enlight_Template_Manager::class);
            $template->setCompileId($template->getCompileId() . '_secure');
        }
    }

    /** * @deprecated - Will be private with Shopware 5.8 * * @return Shop */
    protected function getShopByRequest(Request $request)
    {
        $repository = $this->get(ModelManager::class)->getRepository(Shop::class);

        

        parent::setContainer($loader);

        $this->get('events')->addListener('Enlight_Controller_Plugin_ScriptRenderer_formatControllerName', static function D) {
            return 'ContentType';
        });
    }

    public function preDispatch(): void
    {
        parent::preDispatch();
        $this->View()->Engine()->setCompileId($this->View()->Engine()->getCompileId() . '_' . $this->Request()->getControllerName());
    }

    public function indexAction(): void
    {
        parent::indexAction();
        $this->View()->loadTemplate('backend/content_type/app.js');
    }

    public function postDispatch(): void
    {
        parent::postDispatch();

        
return;
        }

        $localeName = $shop->getLocale()->toString();

        if ($template->getVersion() === 3) {
            $this->registerTheme($template);
        } else {
            throw new RuntimeException(sprintf('Tried to load unsupported template version %s for template: %s', $template->getVersion()$template->getName()));
        }

        $this->container->get(Enlight_Template_Manager::class)->setCompileId(
            sprintf('frontend_%s_%s_%s', $template->toString()$localeName$shop->getId())
        );
    }

    private function registerTheme(Template $template): void
    {
        $path = $this->container->get(Inheritance::class)->getTemplateDirectories($template);
        $this->container->get(Enlight_Template_Manager::class)->setTemplateDir($path);
    }
}
$frontendThemeDirectory = Shopware()->Container()->get(PathResolver::class)->getFrontendThemeDirectory();

        $this->_template = clone Shopware()->Template();
        $this->_view = $this->_template->createData();

        $path = basename($this->_subshop['doc_template']);

        if ($this->_template->security_policy) {
            $this->_template->security_policy->secure_dir[] = $frontendThemeDirectory . DIRECTORY_SEPARATOR . $path;
        }
        $this->_template->setTemplateDir(['custom' => $path]);
        $this->_template->setCompileId(str_replace('/', '_', $path) . '_' . $this->_subshop['id']);
    }

    /** * Sets the translation component * * @throws Exception */
    protected function setTranslationComponent()
    {
        $this->translationComponent = Shopware()->Container()->get(Shopware_Components_Translation::class);
    }

    
$revision = $container->getParameter('shopware.release.revision');

        $locale = $this->getCurrentLocale();
        $container->get('locale')->setLocale($locale->toString());
        $container->get('snippets')->setLocale($locale);
        $template = $container->get(Enlight_Template_Manager::class);
        $baseHash = $this->request->getScheme() . '://'
                  . $this->request->getHttpHost()
                  . $this->request->getBaseUrl() . '?'
                  . $revision;
        $baseHash = substr(sha1($baseHash), 0, 5);
        $template->setCompileId('backend_' . $locale->toString() . '_' . $baseHash);

        if ($this->action !== null && $this->action->View()->hasTemplate()) {
            $this->action->View()->Template()->setCompileId($template->getCompileId());
        }
    }

    /** * Loads current user's locale or, if none exists, the default fallback * * @throws Exception * * @return Locale */
Home | Imprint | This part of the site doesn't use cookies.