Skip to content

Commit

Permalink
[Task] Use new configuration format (#724)
Browse files Browse the repository at this point in the history
* 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 <marco.perberschlager@pimcore.com>
  • Loading branch information
lukmzig and mcop1 committed Apr 6, 2023
1 parent 0b07bef commit 75c3824
Show file tree
Hide file tree
Showing 5 changed files with 10 additions and 28 deletions.
3 changes: 2 additions & 1 deletion .github/ci/files/config/system.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,6 @@ pimcore_admin:
pimcore_data_hub:
config_location:
data_hub:
target: 'settings-store'
write_target:
type: 'settings-store'

3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
4 changes: 2 additions & 2 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
26 changes: 2 additions & 24 deletions src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion src/DependencyInjection/PimcoreDataHubExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit 75c3824

Please sign in to comment.