Skip to content

Commit

Permalink
fix(laravel): graphQl type locator indexes (#6815)
Browse files Browse the repository at this point in the history
  • Loading branch information
amermchaudhary authored Nov 22, 2024
1 parent 7ff9790 commit f19dd94
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/Laravel/ApiPlatformProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -1135,14 +1135,18 @@ private function registerGraphQl(Application $app): void

$app->singleton('api_platform.graphql.type_locator', function (Application $app) {
$tagged = iterator_to_array($app->tagged('api_platform.graphql.type'));
$services = [];
foreach ($tagged as $service) {
$services[$service->name] = $service;
}

return new ServiceLocator($tagged);
return new ServiceLocator($services);
});

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

return new TypesFactory($app->make('api_platform.graphql.type_locator'), array_keys($tagged));
return new TypesFactory($app->make('api_platform.graphql.type_locator'), array_column($tagged, 'name'));
});
$app->singleton(TypesContainerInterface::class, function () {
return new TypesContainer();
Expand Down

0 comments on commit f19dd94

Please sign in to comment.