From 4723831f0df3c83427b35da8a72194ca56937037 Mon Sep 17 00:00:00 2001 From: Artem Dmitriiev Date: Wed, 11 Jan 2023 16:06:13 +0100 Subject: [PATCH] #1322: Add check for tranlsation --- src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php b/src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php index 10ea4e607..1fc086038 100644 --- a/src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php +++ b/src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php @@ -126,6 +126,9 @@ public function resolve($url, ?string $language, FieldContext $context): ?Deferr // Get the correct translation. if (isset($language) && $language != $entity->language()->getId() && $entity instanceof TranslatableInterface) { + if (!$entity->hasTranslation($language)) { + return NULL; + } $entity = $entity->getTranslation($language); $entity->addCacheContexts(["static:language:{$language}"]); }