From 98c509790516c1f65aeaebafc41853652d133ffc Mon Sep 17 00:00:00 2001 From: robertSt7 Date: Tue, 11 Apr 2023 16:37:13 +0200 Subject: [PATCH 1/2] Improve: adapt load symfony files --- .../PimcoreWebToPrintExtension.php | 14 ++------------ 1 file changed, 2 insertions(+), 12 deletions(-) diff --git a/src/DependencyInjection/PimcoreWebToPrintExtension.php b/src/DependencyInjection/PimcoreWebToPrintExtension.php index c1668cc..9de31b1 100644 --- a/src/DependencyInjection/PimcoreWebToPrintExtension.php +++ b/src/DependencyInjection/PimcoreWebToPrintExtension.php @@ -17,6 +17,7 @@ namespace Pimcore\Bundle\WebToPrintBundle\DependencyInjection; use Pimcore\Bundle\CoreBundle\DependencyInjection\ConfigurationHelper; +use Pimcore\Config\LocationAwareConfigRepository; use Symfony\Component\Config\FileLocator; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\PrependExtensionInterface; @@ -50,17 +51,6 @@ public function loadInternal(array $config, ContainerBuilder $container): void public function prepend(ContainerBuilder $container): void { - $containerConfig = ConfigurationHelper::getConfigNodeFromSymfonyTree($container, 'pimcore_web_to_print'); - $configDir = $containerConfig['config_location']['web_to_print']['write_target']['options']['directory']; - $configLoader = new YamlFileLoader( - $container, - new FileLocator($configDir) - ); - - //load configs - $configs = ConfigurationHelper::getSymfonyConfigFiles($configDir); - foreach ($configs as $config) { - $configLoader->load($config); - } + LocationAwareConfigRepository::loadSymfonyConfigFiles($container, 'pimcore_web_to_print', 'web_to_print'); } } From 9218713f8d5a1c1d7c0672ead37e2f0519f25769 Mon Sep 17 00:00:00 2001 From: robertSt7 Date: Wed, 12 Apr 2023 09:34:25 +0200 Subject: [PATCH 2/2] Improve: add additional node read_target --- src/DependencyInjection/Configuration.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index 5755f0d..1eb7818 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -67,7 +67,7 @@ public function getConfigTreeBuilder(): TreeBuilder ->scalarNode('gotenbergSettings')->end() ->end(); - ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, ['web_to_print' => '/var/config/web_to_print']); + ConfigurationHelper::addConfigLocationWithWriteTargetNodes($rootNode, ['web_to_print' => '/var/config/web_to_print'], ['read_target']); return $treeBuilder; }