Skip to content

Commit beec6a7

Browse files
committed
Spike 8.0 entrypoints
1 parent e108fe9 commit beec6a7

3 files changed

Lines changed: 81 additions & 0 deletions

File tree

services.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -139,3 +139,9 @@ services:
139139
$cache: '@oxidesales.graphqlbase.cache'
140140
tags:
141141
- { name: 'console.command', command: 'oe:graphql:cache-clear' }
142+
143+
# OxidEsales\GraphQL\Base\Api\Controller\ApiTestController:
144+
# public: true
145+
146+
OxidEsales\GraphQL\Base\Api\Controller\OxapiController:
147+
public: true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OxidEsales\GraphQL\Base\Api\Controller;
11+
12+
use OxidEsales\Eshop\Application\Model\Article;
13+
use OxidEsales\Eshop\Core\Registry;
14+
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ModuleConfigurationDaoInterface;
15+
use Symfony\Component\HttpFoundation\JsonResponse;
16+
use Symfony\Component\HttpFoundation\Response;
17+
use Symfony\Component\Routing\Attribute\Route;
18+
use Symfony\Component\Routing\Requirement\Requirement;
19+
20+
readonly class ApiTestController
21+
{
22+
public function __construct(private ModuleConfigurationDaoInterface $moduleConfigurationDao)
23+
{
24+
}
25+
26+
#[Route('/api/{name}/{id}/', requirements: ['id' => Requirement::DIGITS], methods: ['GET'])]
27+
public function fly(string $name, int $id): Response
28+
{
29+
Registry::getConfig()->saveShopConfVar('string', 'testControllers', 'hello test');
30+
return new JsonResponse(
31+
[
32+
'name' => $name,
33+
'id' => $id,
34+
'configParameter' => Registry::getConfig()->getShopConfVar('testControllers'),
35+
]
36+
);
37+
}
38+
}
Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?php
2+
3+
/**
4+
* Copyright © OXID eSales AG. All rights reserved.
5+
* See LICENSE file for license details.
6+
*/
7+
8+
declare(strict_types=1);
9+
10+
namespace OxidEsales\GraphQL\Base\Api\Controller;
11+
12+
use OxidEsales\Eshop\Core\Registry;
13+
use OxidEsales\EshopCommunity\Internal\Framework\Module\Configuration\Dao\ModuleConfigurationDaoInterface;
14+
use Symfony\Component\HttpFoundation\JsonResponse;
15+
use Symfony\Component\HttpFoundation\Response;
16+
use Symfony\Component\Routing\Attribute\Route;
17+
use Symfony\Component\Routing\Requirement\Requirement;
18+
19+
readonly class OxapiController
20+
{
21+
public function __construct(private ModuleConfigurationDaoInterface $moduleConfigurationDao)
22+
{
23+
}
24+
25+
#[Route('/oxapi/{name}/{shp}/', requirements: ['shp' => Requirement::DIGITS], methods: ['GET'])]
26+
public function foo(string $name, int $shp): Response
27+
{
28+
Registry::getConfig()->saveShopConfVar('string', 'testControllers', 'hello');
29+
return new JsonResponse(
30+
[
31+
'name' => $name,
32+
'shp' => $shp,
33+
'configParameter' => Registry::getConfig()->getShopConfVar('testControllers'),
34+
]
35+
);
36+
}
37+
}

0 commit comments

Comments
 (0)