Browse code

Implement API authentication and replace test api command to show Shopware status

Benjamin Roth authored on20/10/2024 22:11:52
Showing1 changed files
1 1
deleted file mode 100644
... ...
@@ -1,53 +0,0 @@
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\Command;
14
-
15
-use Contao\CoreBundle\Framework\ContaoFramework;
16
-use Contao\System;
17
-use Symfony\Component\Console\Command\Command;
18
-use Symfony\Component\Console\Input\InputInterface;
19
-use Symfony\Component\Console\Output\OutputInterface;
20
-use vonRotenberg\ShopwareApiBundle\API\Shopware;
21
-
22
-class TestApiConnection extends Command
23
-{
24
-    protected static $defaultName = 'shopware:test-connection';
25
-
26
-    protected $framework;
27
-
28
-    public function __construct(ContaoFramework $framework)
29
-    {
30
-        $this->framework = $framework;
31
-
32
-        parent::__construct();
33
-    }
34
-
35
-    protected function configure(): void
36
-    {
37
-        $this
38
-            ->setName(self::$defaultName)
39
-            ->setDescription('Test connection')
40
-        ;
41
-    }
42
-    protected function execute(InputInterface $input, OutputInterface $output): int
43
-    {
44
-        $this->framework->initialize();
45
-
46
-        /** @var Shopware $Shopware */
47
-        $Shopware = System::getContainer()->get(Shopware::class);
48
-
49
-        dump($Shopware->testApiRequest());
50
-
51
-        return 0;
52
-    }
53
-}
Browse code

Basic setup for API service class and test api command

Benjamin Roth authored on18/10/2024 14:20:37
Showing1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,53 @@
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\Command;
14
+
15
+use Contao\CoreBundle\Framework\ContaoFramework;
16
+use Contao\System;
17
+use Symfony\Component\Console\Command\Command;
18
+use Symfony\Component\Console\Input\InputInterface;
19
+use Symfony\Component\Console\Output\OutputInterface;
20
+use vonRotenberg\ShopwareApiBundle\API\Shopware;
21
+
22
+class TestApiConnection extends Command
23
+{
24
+    protected static $defaultName = 'shopware:test-connection';
25
+
26
+    protected $framework;
27
+
28
+    public function __construct(ContaoFramework $framework)
29
+    {
30
+        $this->framework = $framework;
31
+
32
+        parent::__construct();
33
+    }
34
+
35
+    protected function configure(): void
36
+    {
37
+        $this
38
+            ->setName(self::$defaultName)
39
+            ->setDescription('Test connection')
40
+        ;
41
+    }
42
+    protected function execute(InputInterface $input, OutputInterface $output): int
43
+    {
44
+        $this->framework->initialize();
45
+
46
+        /** @var Shopware $Shopware */
47
+        $Shopware = System::getContainer()->get(Shopware::class);
48
+
49
+        dump($Shopware->testApiRequest());
50
+
51
+        return 0;
52
+    }
53
+}