0 | 6 |
new file mode 100644 |
... | ... |
@@ -0,0 +1,45 @@ |
1 |
+<?php |
|
2 |
+ |
|
3 |
+declare(strict_types=1); |
|
4 |
+ |
|
5 |
+/* |
|
6 |
+ * This file is part of vonRotenberg Shopware API Bundle. |
|
7 |
+ * |
|
8 |
+ * (c) vonRotenberg |
|
9 |
+ * |
|
10 |
+ * @license proprietary |
|
11 |
+ */ |
|
12 |
+ |
|
13 |
+namespace vonRotenberg\ShopwareApiBundle\DependencyInjection; |
|
14 |
+ |
|
15 |
+use Symfony\Component\Config\Definition\Builder\TreeBuilder; |
|
16 |
+use Symfony\Component\Config\Definition\ConfigurationInterface; |
|
17 |
+ |
|
18 |
+class Configuration implements ConfigurationInterface |
|
19 |
+{ |
|
20 |
+ public function getConfigTreeBuilder(): TreeBuilder |
|
21 |
+ { |
|
22 |
+ $treeBuilder = new TreeBuilder('shopware_api'); |
|
23 |
+ $treeBuilder |
|
24 |
+ ->getRootNode() |
|
25 |
+ ->children() |
|
26 |
+ ->arrayNode('credentials') |
|
27 |
+ ->addDefaultsIfNotSet() |
|
28 |
+ ->children() |
|
29 |
+ ->scalarNode('client_id') |
|
30 |
+ ->info('Your Shopware client ID.') |
|
31 |
+ ->end() |
|
32 |
+ ->scalarNode('client_id') |
|
33 |
+ ->info('Your Shopware client secret.') |
|
34 |
+ ->end() |
|
35 |
+ ->scalarNode('api_endpoint') |
|
36 |
+ ->info('The endpoint URL of your Shopware installation.') |
|
37 |
+ ->end() |
|
38 |
+ ->end() |
|
39 |
+ ->end() |
|
40 |
+ ->end() |
|
41 |
+ ; |
|
42 |
+ |
|
43 |
+ return $treeBuilder; |
|
44 |
+ } |
|
45 |
+} |
... | ... |
@@ -21,6 +21,13 @@ class VonrotenbergShopwareApiExtension extends Extension |
21 | 21 |
{ |
22 | 22 |
public function load(array $configs, ContainerBuilder $container): void |
23 | 23 |
{ |
24 |
+ $config = $this->processConfiguration(new Configuration(), $configs); |
|
25 |
+ |
|
26 |
+ foreach($config['credentials'] as $key=>$val) |
|
27 |
+ { |
|
28 |
+ $container->setParameter('shopware_api.credentials.'.$key,$val); |
|
29 |
+ } |
|
30 |
+ |
|
24 | 31 |
$loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config')); |
25 | 32 |
$loader->load('services.yml'); |
26 | 33 |
} |