From 22b0ea7829d48dc70d9d706d0b7ae7dc87c65596 Mon Sep 17 00:00:00 2001 From: pptasinski Date: Fri, 30 Oct 2020 16:16:51 +0100 Subject: [PATCH] move parameters setup to di --- README.md | 1 + src/DependencyInjection/BitBagSyliusWishlistExtension.php | 1 + src/DependencyInjection/Configuration.php | 4 ++++ src/Resources/config/config.yml | 3 --- tests/Application/config/packages/_sylius.yaml | 3 --- 5 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 872e102c..854d5598 100644 --- a/README.md +++ b/README.md @@ -104,6 +104,7 @@ $ bin/console debug:container | grep bitbag_sylius_wishlist_plugin ### Parameters you can override in your parameters.yml(.dist) file ```yml $ bin/console debug:container --parameters | grep bitbag +$ bin/console debug:container --parameters | grep wishlist ``` ## Testing diff --git a/src/DependencyInjection/BitBagSyliusWishlistExtension.php b/src/DependencyInjection/BitBagSyliusWishlistExtension.php index 1e0c0f28..48c164c7 100644 --- a/src/DependencyInjection/BitBagSyliusWishlistExtension.php +++ b/src/DependencyInjection/BitBagSyliusWishlistExtension.php @@ -18,6 +18,7 @@ public function load(array $config, ContainerBuilder $container): void $loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../Resources/config')); $this->registerResources('bitbag_sylius_wishlist_plugin', 'doctrine/orm', $config['resources'], $container); $loader->load('services.yml'); + $container->setParameter('wishlist_cookie_token', $config['wishlist_cookie_token']); } public function prepend(ContainerBuilder $container): void diff --git a/src/DependencyInjection/Configuration.php b/src/DependencyInjection/Configuration.php index d5328d78..e302fe25 100644 --- a/src/DependencyInjection/Configuration.php +++ b/src/DependencyInjection/Configuration.php @@ -23,6 +23,10 @@ public function getConfigTreeBuilder(): TreeBuilder $rootNode = $treeBuilder->getRootNode(); $rootNode ->children() + ->scalarNode('wishlist_cookie_token') + ->defaultValue('wishlist_cookie_token') + ->cannotBeEmpty() + ->end() ->arrayNode('resources') ->addDefaultsIfNotSet() ->children() diff --git a/src/Resources/config/config.yml b/src/Resources/config/config.yml index 72b97185..79b5aba7 100644 --- a/src/Resources/config/config.yml +++ b/src/Resources/config/config.yml @@ -1,6 +1,3 @@ -parameters: - wishlist_cookie_token: bitbag_sylius_wishlist - imports: - { resource: "@BitBagSyliusWishlistPlugin/Resources/config/services.yml" } - { resource: "@BitBagSyliusWishlistPlugin/Resources/config/resources.yml" } diff --git a/tests/Application/config/packages/_sylius.yaml b/tests/Application/config/packages/_sylius.yaml index 79f5ce6c..7905a2a9 100755 --- a/tests/Application/config/packages/_sylius.yaml +++ b/tests/Application/config/packages/_sylius.yaml @@ -1,11 +1,8 @@ imports: - { resource: "@SyliusCoreBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusAdminBundle/Resources/config/app/config.yml" } - { resource: "@SyliusAdminApiBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusShopBundle/Resources/config/app/config.yml" } - - { resource: "@SyliusApiBundle/Resources/config/app/config.yaml" } parameters: