saveConfig example

/** * @deprecated in 5.6, will be private in 5.8 * * Iterates the given data array and persists all config variables */
    public function saveConfigData(array $data)
    {
        trigger_error(sprintf('%s:%s is deprecated since Shopware 5.6 and will be private with 5.8.', __CLASS__, __METHOD__), E_USER_DEPRECATED);

        foreach ($data as $values) {
            foreach ($values as $configKey => $value) {
                $this->saveConfig($configKey$value);
            }
        }
    }

    /** * @deprecated in 5.6, will be private in 5.8 * * General helper method which triggers the prepare...ConfigForSaving methods * * @param array $data * * @return array */
return false;
        }

        $errors = $this->configValidator->validate($manifest, null);
        $configError = $errors->first();

        if ($configError) {
            // only one error can be in the returned collection             throw AppException::invalidConfiguration($manifest->getMetadata()->getName()$configError);
        }

        $this->systemConfigService->saveConfig($config$app->getName() . '.config.', $install);

        return true;
    }

    private function doesAllowDisabling(AppEntity $app, Context $context): bool
    {
        $allow = true;

        $entities = $this->connection->fetchFirstColumn(
            'SELECT fields FROM custom_entity WHERE app_id = :id',
            ['id' => Uuid::fromHexToBytes($app->getId())]
        );

    public function savePluginConfiguration(Bundle $bundle, bool $override = false): void
    {
        try {
            $config = $this->configReader->getConfigFromBundle($bundle);
        } catch (BundleConfigNotFoundException) {
            return;
        }

        $prefix = $bundle->getName() . '.config.';

        $this->saveConfig($config$prefix$override);
    }

    /** * @param array<mixed> $config */
    public function saveConfig(array $config, string $prefix, bool $override): void
    {
        $relevantSettings = $this->getDomain($prefix);

        foreach ($config as $card) {
            foreach ($card['elements'] as $element) {
                
'data' => $this->get(Service::class)->getConfigSets($template),
        ]);
    }

    /** * Saves the passed theme configuration. */
    public function save($data)
    {
        $theme = $this->getRepository()->find($data['id']);

        $this->get(Service::class)->saveConfig(
            $theme,
            $data['values']
        );

        return ['success' => true];
    }

    /** * Controller action which is used to upload a theme zip file * and extract it into the engine\Shopware\Themes folder. * * @throws Exception * * @return void */

        }$themeConfigKeys);

        $theme = $this->container->get(ModelManager::class)
            ->getRepository(Template::class)
            ->findOneBy(['template' => 'Responsive']);

        $themeConfigValues = array_filter($themeConfigValuesfunction D$config) {
            return !empty($config['value']);
        });

        $this->container->get(Service::class)->saveConfig($theme$themeConfigValues);
        $this->container->get('theme_timestamp_persistor')->updateTimestamp($defaultShop->getId()time());

        /** * Save shop config */
        $shopConfigKeys = [
            'shopName',
            'mail',
            'address',
            'bankAccount',
            'company',
            
Home | Imprint | This part of the site doesn't use cookies.