From 75c3824d44a8accfe830620a62e7ff287df6db89 Mon Sep 17 00:00:00 2001 From: lukmzig <30526586+lukmzig@users.noreply.github.com> Date: Thu, 6 Apr 2023 21:21:04 +0200 Subject: [PATCH] [Task] Use new configuration format (#724) * fix: use new configuration format * fix: test settings * fix: use configuration helper introduced in 10.6 * Adapted ignored messeages * Added conflicts for existing alpha versions, since they are not compatibel anymore --------- Co-authored-by: Marco Perberschlager --- .github/ci/files/config/system.yml | 3 ++- composer.json | 3 +++ phpstan-baseline.neon | 4 +-- src/DependencyInjection/Configuration.php | 26 ++----------------- .../PimcoreDataHubExtension.php | 2 +- 5 files changed, 10 insertions(+), 28 deletions(-) diff --git a/.github/ci/files/config/system.yml b/.github/ci/files/config/system.yml index ffc5758f..2ae4a3d8 100644 --- a/.github/ci/files/config/system.yml +++ b/.github/ci/files/config/system.yml @@ -75,5 +75,6 @@ pimcore_admin: pimcore_data_hub: config_location: data_hub: - target: 'settings-store' + write_target: + type: 'settings-store' diff --git a/composer.json b/composer.json index 1a821430..f4c469b6 100644 --- a/composer.json +++ b/composer.json @@ -18,6 +18,9 @@ "pimcore/compatibility-bridge-v10": "1.x-dev", "webonyx/graphql-php": "^15.2.3" }, + "conflict": { + "pimcore/pimcore": "v11.0.0-ALPHA8 || v11.0.0-ALPHA7 || v11.0.0-ALPHA6 || v11.0.0-ALPHA5 || v11.0.0-ALPHA4 || v11.0.0-ALPHA3 || v11.0.0-ALPHA2 || v11.0.0-ALPHA1" + }, "require-dev": { "phpstan/phpstan": "^1.9", "phpunit/phpunit": "^9.6", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 8a0ab418..9f4b1646 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -11,12 +11,12 @@ parameters: path: src/DependencyInjection/Configuration.php - - message: "#^Call to static method getConfigNodeFromSymfonyTree\\(\\)\\ on an unknown class Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper.$#" + message: "#^Call to an undefined static method Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper\\:\\:getConfigNodeFromSymfonyTree\\(\\)\\.$#" count: 1 path: src/DependencyInjection/PimcoreDataHubExtension.php - - message: "#^Call to static method getSymfonyConfigFiles\\(\\)\\ on an unknown class Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper.$#" + message: "#^Call to an undefined static method Pimcore\\\\Bundle\\\\CoreBundle\\\\DependencyInjection\\\\ConfigurationHelper\\:\\:getSymfonyConfigFiles\\(\\)\\.$#" count: 1 path: src/DependencyInjection/PimcoreDataHubExtension.php diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index ee10d803..582c7cdc 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -47,30 +47,8 @@ public function getConfigTreeBuilder() $this->addConfigurationsNode($rootNode); $this->addSupportedTypes($rootNode); - if (\Pimcore\Version::getMajorVersion() >= 11) { - /** @var ArrayNodeDefinition $rootNode */ - ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, ['data_hub']); - } else { - $rootNode - ->children() - ->arrayNode('config_location') - ->addDefaultsIfNotSet() - ->children() - ->arrayNode('data_hub') - ->addDefaultsIfNotSet() - ->children() - ->enumNode('target') - ->values(['symfony-config', 'settings-store', 'disabled']) - ->defaultValue('symfony-config') - ->end() - ->arrayNode('options') - ->defaultValue(['directory' => '%kernel.project_dir%data_hub']) - ->variablePrototype() - ->end() - ->end() - ->end() - ->end(); - } + /** @var ArrayNodeDefinition $rootNode */ + ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, ['data_hub' => '/var/config/data_hub']); return $treeBuilder; } diff --git a/src/DependencyInjection/PimcoreDataHubExtension.php b/src/DependencyInjection/PimcoreDataHubExtension.php index 6f41d6aa..f58f33f3 100644 --- a/src/DependencyInjection/PimcoreDataHubExtension.php +++ b/src/DependencyInjection/PimcoreDataHubExtension.php @@ -56,7 +56,7 @@ public function prepend(ContainerBuilder $container) if (\Pimcore\Version::getMajorVersion() >= 11) { $containerConfig = ConfigurationHelper::getConfigNodeFromSymfonyTree($container, 'pimcore_data_hub'); - $configDir = $containerConfig['config_location']['data_hub']['options']['directory']; + $configDir = $containerConfig['config_location']['data_hub']['write_target']['options']['directory']; } $configLoader = new YamlFileLoader(