Skip to content

Commit

Permalink
Merge pull request #7 from pimcore/add_read_target
Browse files Browse the repository at this point in the history
[Improvement]: adapt load symfony files
  • Loading branch information
mcop1 authored Apr 13, 2023
2 parents aae4c86 + 9218713 commit 84237a5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/DependencyInjection/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
14 changes: 2 additions & 12 deletions src/DependencyInjection/PimcoreWebToPrintExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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');
}
}

0 comments on commit 84237a5

Please sign in to comment.