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

FIX Allow custom SELECT to be used for sorting in DataQuery::column() #10173

Merged
merged 1 commit into from
Dec 13, 2021

Conversation

GuySartorelli
Copy link
Member

If a custom select clause (using special features such as CASE) is used, and it was added using SQLSelect::selectField, the custom select clause should be retained when calling DataQuery::column().

I know that using SQLSelect::addOrderBy to add the select clause is handled correctly, but that's because it uses a special alias. If I want to use a specific alias, I can't rely on that.

@michalkleiner
Copy link
Contributor

Thanks for the PR, @GuySartorelli. Is there any chance you could add a test for this fix?

@michalkleiner michalkleiner changed the title FIX allow custom SELECT to be used for sorting in DataQuery::column(). FIX Allow custom SELECT to be used for sorting in DataQuery::column() Dec 10, 2021
@GuySartorelli
Copy link
Member Author

@michalkleiner Test added.

@michalkleiner
Copy link
Contributor

Thanks @GuySartorelli, wonderful!

Could you please squash the commits into one saying "FIX Allow custom SELECT to be used for sorting in DataQuery::column()" and then we're good to merge.

If a custom select clause (using special features such as `CASE`) is used, and it was added using `SQLSelect::selectField`, the custom select clause should be retained when calling DataQuery::column().
@GuySartorelli
Copy link
Member Author

@michalkleiner Commits squashed.

@michalkleiner michalkleiner merged commit 645e1f1 into silverstripe:4 Dec 13, 2021
@GuySartorelli GuySartorelli deleted the patch-2 branch December 13, 2021 22:19
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.

2 participants