-
Notifications
You must be signed in to change notification settings - Fork 202
Respect currently negotiated language. #670
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
Conversation
Set global query variable to current language and use it for contextual arguments. Add languages to cache contexts.
Codecov Report
@@ Coverage Diff @@
## 8.x-3.x #670 +/- ##
===========================================
+ Coverage 79.66% 79.72% +0.06%
===========================================
Files 192 192
Lines 3039 3058 +19
===========================================
+ Hits 2421 2438 +17
- Misses 618 620 +2
Continue to review full report at Codecov.
|
}); | ||
return new Deferred( | ||
function () use ($result, $value, $args, $context, $info) { | ||
if ($this->isLanguageAwareField()) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No need to call this twice (isLanguageAwareField()). Just cache the result and re-use it here.
else { | ||
$args[$argument] = $context->getContext($argument, $info); | ||
} | ||
$args[$argument] = $context->getContext($argument, $info, $context->getGlobal($argument)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need something else than getGlobal / setGlobal? Basically set the root field? Globals were rather meant as a configuration value. Instead of having to use getContext() with a default value everytime, I'd rather set a root context so getContext() automatically finds it.
$context->getContext('language', $info) | ||
); | ||
} | ||
else { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This else statement is redundant
# Conflicts: # src/GraphQL/Execution/QueryProcessor.php
Set global query variable to current language and use it for
contextual arguments. Add languages to cache contexts.