From 782cc63893719fea7ef5f172e6dcbfb24ebb796a Mon Sep 17 00:00:00 2001 From: Pierre Rineau Date: Thu, 21 Nov 2024 15:47:59 +0100 Subject: [PATCH] no issue - fix configuration regression when 'connections' is being used as a string --- docs/content/getting-started/installation.md | 1 - .../DependencyInjection/DbToolsConfiguration.php | 12 +++++++----- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/docs/content/getting-started/installation.md b/docs/content/getting-started/installation.md index 1135457..db237bd 100644 --- a/docs/content/getting-started/installation.md +++ b/docs/content/getting-started/installation.md @@ -58,7 +58,6 @@ Then, copy the default configuration file from the vendor directory: ```sh cd your_project_dir cp vendor/makinacorpus/db-tools-bundle/config/db_tools.standalone.sample.yaml db_tools.config.yaml -cp config/anonymizations.sample.yaml db_tools.anonymization.yaml ``` Update these files to your needs. The only required parameter is `connections` in which you diff --git a/src/Bridge/Symfony/DependencyInjection/DbToolsConfiguration.php b/src/Bridge/Symfony/DependencyInjection/DbToolsConfiguration.php index ef66596..901ee48 100644 --- a/src/Bridge/Symfony/DependencyInjection/DbToolsConfiguration.php +++ b/src/Bridge/Symfony/DependencyInjection/DbToolsConfiguration.php @@ -117,14 +117,16 @@ public function getConfigTreeBuilder(): TreeBuilder $connectionsNode = $rootNode ->children() ->arrayNode('connections') + ->beforeNormalization()->ifString()->then(function ($v) { return ['default' => $v]; })->end() ->useAttributeAsKey('name') ->arrayPrototype() - ->children() - ->scalarNode('url') - ->defaultNull() + ->beforeNormalization()->ifString()->then(function ($v) { return ['url' => $v]; })->end() + ->children() + ->scalarNode('url') + ->defaultNull() + ->end() ->end() - ->end() - // Do not close arrayNode() we use it below. + // Do not close arrayNode() we use it below. ; \assert($connectionsNode instanceof ArrayNodeDefinition); $this->addConnectionConfigTreeBuilder($connectionsNode);