99
1010namespace OxidEsales \GraphQL \Base \Framework ;
1111
12- use Mouf \ Composer \ ClassNameMapper ;
12+ use Kcs \ ClassFinder \ Finder \ Psr4Finder ;
1313use OxidEsales \GraphQL \Base \Service \Authentication ;
1414use OxidEsales \GraphQL \Base \Service \Authorization ;
1515use 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}
0 commit comments