getSystemConfiguration example


    private function synchronizeThemeDirectories(DirectoryIterator $directories, ?Plugin $plugin = null)
    {
        $themes = [];

        $settings = $this->service->getSystemConfiguration(
            AbstractQuery::HYDRATE_OBJECT
        );

        /** @var DirectoryIterator $directory */
        foreach ($directories as $directory) {
            // Check valid directory
            if ($directory->isDot() || !$directory->isDir() || $directory->getFilename() === '_cache') {
                continue;
            }

            

    $time = $params['timestamp'];
    $output = $params['output'];

    /** @var \Shopware\Components\Theme\PathResolver $pathResolver */
    $pathResolver = Shopware()->Container()->get(\Shopware\Components\Theme\PathResolver::class);

    /** @var \Shopware\Models\Shop\Shop $shop */
    $shop = Shopware()->Container()->get('shop');

    /** @var \Shopware\Models\Theme\Settings $settings */
    $settings = Shopware()->Container()->get(\Shopware\Components\Theme\Service::class)->getSystemConfiguration(
        \Doctrine\ORM\AbstractQuery::HYDRATE_OBJECT
    );

    $file = $pathResolver->getJsFilePath($shop$time);
    $url = $pathResolver->formatPathToUrl($file$shop);

    if (!$settings->getForceCompile() && file_exists($file)) {
        // see: http://stackoverflow.com/a/9473886         $template->assign($output[$url]);

        return;
    }

    $time = $params['timestamp'];
    $output = $params['output'];

    /** @var \Shopware\Components\Theme\PathResolver $pathResolver */
    $pathResolver = Shopware()->Container()->get(\Shopware\Components\Theme\PathResolver::class);

    /** @var \Shopware\Models\Shop\Shop $shop */
    $shop = Shopware()->Container()->get('shop');

    /** @var \Shopware\Models\Theme\Settings $settings */
    $settings = Shopware()->Container()->get(\Shopware\Components\Theme\Service::class)->getSystemConfiguration(
        \Doctrine\ORM\AbstractQuery::HYDRATE_OBJECT
    );

    $file = $pathResolver->getCssFilePath($shop$time);
    $url = $pathResolver->formatPathToUrl($file$shop);

    if (!$settings->getForceCompile() && file_exists($file)) {
        // see: http://stackoverflow.com/a/9473886         $template->assign($output[$url]);

        return;
    }
return $builder->getQuery()->getOneOrNullResult($hydration);
    }

    /** * Saves the passed configuration data into the database. * * @param array $data */
    public function saveSystemConfiguration($data)
    {
        $settings = $this->getSystemConfiguration(AbstractQuery::HYDRATE_OBJECT);

        if (!$settings instanceof Settings) {
            $settings = new Settings();
            $this->entityManager->persist($settings);
        }
        $settings->fromArray($data);
        $this->entityManager->flush();
    }

    /** * This function returns the nested configuration layout * and translate the element and container snippets. * If a shop instance passed, the function selects additionally the * element values of the passed shop. * * @return array */
$this->View()->assign('success', true);
    }

    /** * @return void */
    public function loadSettingsAction()
    {
        $this->View()->assign([
            'success' => true,
            'data' => $this->container->get(Service::class)->getSystemConfiguration(),
        ]);
    }

    /** * @return void */
    public function saveSettingsAction()
    {
        $this->View()->assign([
            'success' => true,
            'data' => $this->container->get(Service::class)->saveSystemConfiguration(
                

        if ($shop->getMain()) {
            $shop = $shop->getMain();
        }

        $file = $this->pathResolver->getTmpJsFilePath($shop$timestamp);
        $file = new SplFileObject($file, 'w');
        if (!$file->flock(LOCK_EX | LOCK_NB)) {
            return;
        }

        $settings = $this->service->getSystemConfiguration(
            AbstractQuery::HYDRATE_OBJECT
        );

        $javascriptFiles = $this->javascriptCollector->collectJavascriptFiles($template$shop);
        $content = '';
        foreach ($javascriptFiles as $jsFile) {
            $content .= file_get_contents($jsFile) . ";\n";
        }

        if ($settings->getCompressJs()) {
            $content = $this->jsCompressor->compress($content);
        }
Home | Imprint | This part of the site doesn't use cookies.