Skip to content

Commit f19dd94

Browse files
fix(laravel): graphQl type locator indexes (#6815)
1 parent 7ff9790 commit f19dd94

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/Laravel/ApiPlatformProvider.php

+6-2
Original file line numberDiff line numberDiff line change
@@ -1135,14 +1135,18 @@ private function registerGraphQl(Application $app): void
11351135

11361136
$app->singleton('api_platform.graphql.type_locator', function (Application $app) {
11371137
$tagged = iterator_to_array($app->tagged('api_platform.graphql.type'));
1138+
$services = [];
1139+
foreach ($tagged as $service) {
1140+
$services[$service->name] = $service;
1141+
}
11381142

1139-
return new ServiceLocator($tagged);
1143+
return new ServiceLocator($services);
11401144
});
11411145

11421146
$app->singleton(TypesFactoryInterface::class, function (Application $app) {
11431147
$tagged = iterator_to_array($app->tagged('api_platform.graphql.type'));
11441148

1145-
return new TypesFactory($app->make('api_platform.graphql.type_locator'), array_keys($tagged));
1149+
return new TypesFactory($app->make('api_platform.graphql.type_locator'), array_column($tagged, 'name'));
11461150
});
11471151
$app->singleton(TypesContainerInterface::class, function () {
11481152
return new TypesContainer();

0 commit comments

Comments
 (0)