From 2490a4ed5e55b8d864614f1721688df70e99ea67 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Marcachi?= Date: Thu, 17 Sep 2020 15:18:12 +0200 Subject: [PATCH] Fixing graphql error when requesting properties having null as value --- src/GraphQl/Resolver/Factory/ItemResolverFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/GraphQl/Resolver/Factory/ItemResolverFactory.php b/src/GraphQl/Resolver/Factory/ItemResolverFactory.php index ed00054e537..8bd845e31e0 100644 --- a/src/GraphQl/Resolver/Factory/ItemResolverFactory.php +++ b/src/GraphQl/Resolver/Factory/ItemResolverFactory.php @@ -60,7 +60,7 @@ public function __invoke(?string $resourceClass = null, ?string $rootClass = nul { return function (?array $source, array $args, $context, ResolveInfo $info) use ($resourceClass, $rootClass, $operationName) { // Data already fetched and normalized (field or nested resource) - if (isset($source[$info->fieldName])) { + if (isset($source[$info->fieldName]) || (\is_array($source) && \array_key_exists($info->fieldName, $source) && null === $source[$info->fieldName] && null === $resourceClass)) { return $source[$info->fieldName]; }