Open vermario opened 10 months ago
Does it need to return NULL?
Just wrapping the getTranslation
with hasTranslation
might be the desired outcome, with a fallback to default content.
Edit: Nevermind, I just read the linked PR from previous conversation. Allll good.
I think this makes sense. I was thinking if we need to add cache information before returning NULL, but since it should vary per language parameter anyway I think this is fine.
Can you add a test case to cover this?
It's missing also the fix in the DataProducer TaxonomyLoadTree.
If an entity is requested directly with a translation that it does not yet have, currently we see a fatal error, because the code tries to load the entity translation before checking for its existence.
This was noted by @artemvd in https://github.com/drupal-graphql/graphql/issues/1322.
The PR that was created #1323 didn't fix the issue in two additional plugins, this PR does, by adding the same code.