Skip to content

Commit c899a3d

Browse files
authored
fix(laravel): graphql (#6855)
fix graphql resolvers, by also taking tagged resolvers into account and injecting them Signed-off-by: Tobias Oitzinger <[email protected]>
1 parent b4e5494 commit c899a3d

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/Laravel/ApiPlatformProvider.php

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@
1919
use ApiPlatform\GraphQl\ExecutorInterface;
2020
use ApiPlatform\GraphQl\Resolver\Factory\ResolverFactory;
2121
use ApiPlatform\GraphQl\Resolver\Factory\ResolverFactoryInterface;
22+
use ApiPlatform\GraphQl\Resolver\QueryCollectionResolverInterface;
23+
use ApiPlatform\GraphQl\Resolver\QueryItemResolverInterface;
2224
use ApiPlatform\GraphQl\Resolver\ResourceFieldResolver;
2325
use ApiPlatform\GraphQl\Serializer\Exception\ErrorNormalizer as GraphQlErrorNormalizer;
2426
use ApiPlatform\GraphQl\Serializer\Exception\HttpExceptionNormalizer as GraphQlHttpExceptionNormalizer;
@@ -1193,10 +1195,12 @@ private function registerGraphQl(Application $app): void
11931195

11941196
$app->singleton(ResolverProvider::class, function (Application $app) {
11951197
$resolvers = iterator_to_array($app->tagged('api_platform.graphql.resolver'));
1198+
$taggedItemResolvers = iterator_to_array($app->tagged(QueryItemResolverInterface::class));
1199+
$taggedCollectionResolvers = iterator_to_array($app->tagged(QueryCollectionResolverInterface::class));
11961200

11971201
return new ResolverProvider(
11981202
$app->make(GraphQlReadProvider::class),
1199-
new ServiceLocator($resolvers),
1203+
new ServiceLocator([...$resolvers, ...$taggedItemResolvers, ...$taggedCollectionResolvers]),
12001204
);
12011205
});
12021206

0 commit comments

Comments
 (0)