Browse code

Add mapping helper and configuration

Benjamin Roth authored on07/11/2024 13:35:01
Showing1 changed files
... ...
@@ -27,6 +27,10 @@ class VonrotenbergShopwareApiExtension extends Extension
27 27
         {
28 28
             $container->setParameter('vonrotenberg_shopware_api.credentials.'.$key,$val);
29 29
         }
30
+        foreach($config['mappings'] as $key=>$val)
31
+        {
32
+            $container->setParameter('vonrotenberg_shopware_api.mappings.'.$key,$val);
33
+        }
30 34
 
31 35
         $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
32 36
         $loader->load('services.yml');
Browse code

Change configuration and define defaults

Benjamin Roth authored on18/10/2024 11:55:26
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,34 @@
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\FileLocator;
16
+use Symfony\Component\DependencyInjection\ContainerBuilder;
17
+use Symfony\Component\DependencyInjection\Extension\Extension;
18
+use Symfony\Component\DependencyInjection\Loader\YamlFileLoader;
19
+
20
+class VonrotenbergShopwareApiExtension extends Extension
21
+{
22
+    public function load(array $configs, ContainerBuilder $container): void
23
+    {
24
+        $config = $this->processConfiguration(new Configuration(), $configs);
25
+
26
+        foreach($config['credentials'] as $key=>$val)
27
+        {
28
+            $container->setParameter('vonrotenberg_shopware_api.credentials.'.$key,$val);
29
+        }
30
+
31
+        $loader = new YamlFileLoader($container, new FileLocator(__DIR__.'/../../config'));
32
+        $loader->load('services.yml');
33
+    }
34
+}