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

Add GraphQL context as 3rd argument to custom relation 'query' #464

Merged
merged 1 commit into from
Aug 27, 2019

Conversation

mfn
Copy link
Collaborator

@mfn mfn commented Aug 26, 2019

Allows to mutate the context from within e.g. a GraphQL query and safely
pass data down to custom relation queries.

The test \Rebing\GraphQL\Tests\Database\SelectFields\QueryArgsAndContextTests\NestedRelationLoadingTest::testGraphqlQueryFlagOverridesCustomQueryThrougContext shows off the high picture working:

  • The context is \Rebing\GraphQL\Tests\Database\SelectFields\QueryArgsAndContextTests\GraphQLContext
  • In \Rebing\GraphQL\Tests\Database\SelectFields\QueryArgsAndContextTests\UsersQuery::resolve the context receives the $args data
  • And in 'query' in \Rebing\GraphQL\Tests\Database\SelectFields\QueryArgsAndContextTests\PostType::fields and \Rebing\GraphQL\Tests\Database\SelectFields\QueryArgsAndContextTests\UserType::fields is it used

Fixes #459

@mfn mfn self-assigned this Aug 26, 2019
@mfn mfn marked this pull request as ready for review August 26, 2019 16:05
@mfn mfn requested a review from rebing August 26, 2019 16:22
Copy link
Owner

@rebing rebing left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, nice work

Allows to mutate the context from within e.g. a GraphQL query and safely
pass data down to custom relation queries.

Fixes rebing#459
?Closure $customQuery = null,
bool $topLevel = true,
$ctx = null
) {
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Decided it was time to stop this "long line" madness and finally break them; did this a way times in this PR

@mfn mfn merged commit 8209277 into rebing:master Aug 27, 2019
@mfn mfn deleted the mfn-ctx branch August 27, 2019 09:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Args array is empty in GraphQLType fields() function
2 participants