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

allow adding columns in query field #806

Merged
merged 5 commits into from
May 4, 2022

Conversation

crissi
Copy link
Contributor

@crissi crissi commented Jul 21, 2021

Summary

Allow adding columns in query closure. Fixes: #875

People might be using addSelect() in their model relationship or have a need to ad an extra column to a query direcly in the custom query.

Type of change:

  • Bug fix (non-breaking change which fixes an issue)

Checklist:

  • [x ] Existing tests have been adapted and/or new tests have been added
  • Add a CHANGELOG.md entry
  • Update the README.md
  • Code style has been fixed via composer fix-style

Copy link
Collaborator

@mfn mfn left a comment

Choose a reason for hiding this comment

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

See my inline feedback, this is a BC break.

I can see the argument for your use case, but then we break the others and there's no "right or wrong" here. We currently support the one case and afterwards only the other.

Basically for this to work, we would need to keep the current 'query' and add another one, invoked afterwards.

Interestingly, now that your #799 is merged, you could extend SelectFields, override getSelectableFieldsAndRelations and make any logic you want…

What do you think? How do you want to proceed here? I can't merge "as is" as I don't see a good argument made for changing/dropping the existing behavuour.

@crissi
Copy link
Contributor Author

crissi commented Jan 31, 2022

Hi mfn.
I opened again using, addSelect and not reordering the way with and select works

@crissi crissi force-pushed the allow_adding_columns_in_query_field branch from 2ce5271 to 6994c82 Compare January 31, 2022 10:53
Copy link
Collaborator

@mfn mfn left a comment

Choose a reason for hiding this comment

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

Looks more elegant, but technically it's still change of behaviour…

Test coverage LGTM and I also can't think of case were this actually would break.

Are we sure we've no concerns here? Or should be rather wait for a major version bump?

We would also need a good / explanatory changelog for that one, so ppl understand the impact of the change.

WDYT?

@crissi
Copy link
Contributor Author

crissi commented May 3, 2022

could add it to this example: https://github.com/rebing/graphql-laravel#type-relationship-query
so it also included addSelect(

I personally dont think this can cause any errors.

Copy link
Collaborator

@mfn mfn left a comment

Choose a reason for hiding this comment

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

could add it to this example

Ok, let's do this. Yes, please add it :)

@crissi crissi force-pushed the allow_adding_columns_in_query_field branch from 6994c82 to f179c61 Compare May 4, 2022 08:49
@crissi crissi force-pushed the allow_adding_columns_in_query_field branch from f179c61 to 1bc3d24 Compare May 4, 2022 09:40
@crissi
Copy link
Contributor Author

crissi commented May 4, 2022

could add it to this example

Ok, let's do this. Yes, please add it :)

added

Copy link
Collaborator

@mfn mfn left a comment

Choose a reason for hiding this comment

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

Thank you!

@mfn mfn merged commit a0e39a5 into rebing:master May 4, 2022
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.

Can't control loaded columns/relations in custom query
2 participants