Skip to content

Commit 80ad5ad

Browse files
committed
OXDEV-8670 Upgrade GraphQLite to 7.0
1 parent b4efd50 commit 80ad5ad

6 files changed

Lines changed: 62 additions & 16 deletions

File tree

CHANGELOG-v11.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,6 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1111
- Replaced `TokenFilterList::fromUserInput` and `TokenSorting::fromUserInput` with direct object instantiation
1212
- Removed static access for `Legacy::createUniqueIdentifier()` and made it an instance method
1313
- Updated `MissingSignatureKey` exception to use a constructor instead of a static factory method
14+
- Upgrade GraphQLite to 7.0
1415

1516
[11.0.0]: https://github.com/OXID-eSales/graphql-base-module/compare/v10.0.0...b-7.3.x

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
"require": {
99
"php": "^8.2",
1010
"ext-json": "*",
11-
"thecodingmachine/graphqlite": "^6.2",
11+
"thecodingmachine/graphqlite": "^7.0",
1212
"lcobucci/jwt": "^4.1",
1313
"symfony/cache": "*",
1414
"ecodev/graphql-upload": "^7.0.0",
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
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\Framework;
11+
12+
use AppendIterator;
13+
use Kcs\ClassFinder\Finder\FinderInterface;
14+
use Kcs\ClassFinder\Finder\Psr4Finder;
15+
use Kcs\ClassFinder\Finder\ReflectionFilterTrait;
16+
use Traversable;
17+
18+
/**
19+
* @internal This class is not covered by the backward compatibility promise
20+
*/
21+
class Psr4AggregatedFinder implements FinderInterface
22+
{
23+
use ReflectionFilterTrait;
24+
25+
private AppendIterator $iterator;
26+
27+
public function __construct()
28+
{
29+
$this->iterator = new AppendIterator();
30+
}
31+
32+
public function addFinder(Psr4Finder $finder): void
33+
{
34+
$this->iterator->append($finder->getIterator());
35+
}
36+
37+
public function getIterator(): Traversable
38+
{
39+
return $this->iterator;
40+
}
41+
}

src/Framework/SchemaFactory.php

Lines changed: 15 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99

1010
namespace OxidEsales\GraphQL\Base\Framework;
1111

12-
use Mouf\Composer\ClassNameMapper;
12+
use Kcs\ClassFinder\Finder\Psr4Finder;
1313
use OxidEsales\GraphQL\Base\Service\Authentication;
1414
use OxidEsales\GraphQL\Base\Service\Authorization;
1515
use Psr\SimpleCache\CacheInterface;
@@ -60,27 +60,23 @@ public function getSchema(): Schema
6060
$this->container
6161
);
6262

63-
$classNameMapper = new ClassNameMapper();
63+
$finder = new Psr4AggregatedFinder();
6464

6565
foreach ($this->namespaceMappers as $namespaceMapper) {
6666
foreach ($namespaceMapper->getControllerNamespaceMapping() as $namespace => $path) {
67-
$classNameMapper->registerPsr4Namespace(
68-
$namespace,
69-
$path
70-
);
67+
$namespace = $this->trimNamespace($namespace);
68+
$finder->addFinder(new Psr4Finder($namespace, $path));
7169
$factory->addControllerNameSpace($namespace);
7270
}
7371

7472
foreach ($namespaceMapper->getTypeNamespaceMapping() as $namespace => $path) {
75-
$classNameMapper->registerPsr4Namespace(
76-
$namespace,
77-
$path
78-
);
73+
$namespace = $this->trimNamespace($namespace);
74+
$finder->addFinder(new Psr4Finder($namespace, $path));
7975
$factory->addTypeNameSpace($namespace);
8076
}
8177
}
8278

83-
$factory->setClassNameMapper($classNameMapper);
79+
$factory->setFinder($finder);
8480

8581
$factory->setAuthenticationService($this->authentication)
8682
->setAuthorizationService($this->authorization);
@@ -90,4 +86,12 @@ public function getSchema(): Schema
9086

9187
return $this->schema;
9288
}
89+
90+
/**
91+
* @deprecated The leading backslash is unnecessary and not recommended. It will not be supported in the future.
92+
*/
93+
private function trimNamespace(string $namespace): string
94+
{
95+
return ltrim($namespace, '\\');
96+
}
9397
}

src/Service/NamespaceMapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class NamespaceMapper implements NamespaceMapperInterface
1616
public function getControllerNamespaceMapping(): array
1717
{
1818
return [
19-
'\\OxidEsales\\GraphQL\\Base\\Controller' => __DIR__ . '/../Controller/',
19+
'OxidEsales\\GraphQL\\Base\\Controller' => __DIR__ . '/../Controller/',
2020
];
2121
}
2222

2323
public function getTypeNamespaceMapping(): array
2424
{
2525
return [
26-
'\\OxidEsales\\GraphQL\\Base\\DataType' => __DIR__ . '/../DataType/',
26+
'OxidEsales\\GraphQL\\Base\\DataType' => __DIR__ . '/../DataType/',
2727
];
2828
}
2929
}

tests/Integration/Framework/Service/NamespaceMapper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,14 +16,14 @@ class NamespaceMapper implements NamespaceMapperInterface
1616
public function getControllerNamespaceMapping(): array
1717
{
1818
return [
19-
'\\OxidEsales\\GraphQL\\Base\\Tests\\Integration\\Framework\\Controller' => __DIR__ . '/../Controller/',
19+
'OxidEsales\\GraphQL\\Base\\Tests\\Integration\\Framework\\Controller' => __DIR__ . '/../Controller/',
2020
];
2121
}
2222

2323
public function getTypeNamespaceMapping(): array
2424
{
2525
return [
26-
'\\OxidEsales\\GraphQL\\Base\\Tests\\Integration\\Framework\\DataType' => __DIR__ . '/../DataType/',
26+
'OxidEsales\\GraphQL\\Base\\Tests\\Integration\\Framework\\DataType' => __DIR__ . '/../DataType/',
2727
];
2828
}
2929
}

0 commit comments

Comments
 (0)