Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Route Entity data producer with non-existing translation #1322

Open
artemvd opened this issue Jan 11, 2023 · 4 comments
Open

Route Entity data producer with non-existing translation #1322

artemvd opened this issue Jan 11, 2023 · 4 comments
Labels

Comments

@artemvd
Copy link

artemvd commented Jan 11, 2023

This plugin tries to load entity translation based on the language argument. But in case that translation doesn't exist Drupal's ContentEntityBase class throws exception Invalid translation language ($langcode) specified. .

I suggest to add check if translation exists before trying to get it.

artemvd added a commit to artemvd/graphql that referenced this issue Jan 11, 2023
@artemvd
Copy link
Author

artemvd commented Jan 11, 2023

PR: #1323

@hchonov
Copy link

hchonov commented Jan 11, 2023

If the entity has been requested in a specific translation, that the entity does not have then I agree that the return value should be NULL since we cannot actually resolve the requested set of parameters.

@jacintocapote
Copy link

This looks like a perfect approach and is working perfect.

@Kingdutch Kingdutch added the 4.x label Apr 18, 2023
vermario added a commit to vermario/graphql that referenced this issue Jan 16, 2024
…ty for a language the entity is not translated into.

 This same pattern happens in three plugins, this fixes in all of them.
@vermario
Copy link

hi! I think this is a great fix, the same code exists though also in the EntityLoad and EntityLoadByUuid plugins, so I made a new PR: #1388 .

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants