Skip to content

Commit 4723831

Browse files
authored
drupal-graphql#1322: Add check for tranlsation
1 parent 5c83c82 commit 4723831

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

src/Plugin/GraphQL/DataProducer/Routing/RouteEntity.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,9 @@ public function resolve($url, ?string $language, FieldContext $context): ?Deferr
126126

127127
// Get the correct translation.
128128
if (isset($language) && $language != $entity->language()->getId() && $entity instanceof TranslatableInterface) {
129+
if (!$entity->hasTranslation($language)) {
130+
return NULL;
131+
}
129132
$entity = $entity->getTranslation($language);
130133
$entity->addCacheContexts(["static:language:{$language}"]);
131134
}

0 commit comments

Comments
 (0)