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

API Add strong-typing to SearchContext::getQuery() $limit param #11534

Conversation

GuySartorelli
Copy link
Member

Seems the two search context implementations had different ideas about what was correct for the limit parameter, and the basic one wasn't even handling the values correctly.

Issue

@GuySartorelli GuySartorelli marked this pull request as draft January 7, 2025 20:51
@GuySartorelli GuySartorelli force-pushed the pulls/6.0/searchcontext-confusion branch from 7a34d0a to a83de6e Compare January 7, 2025 21:15
Comment on lines -200 to -202
if (!($existingQuery instanceof DataList)) {
throw new InvalidArgumentException("existingQuery must be DataList");
}
Copy link
Member Author

Choose a reason for hiding this comment

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

It's strongly typed so this is dead code.

@GuySartorelli GuySartorelli force-pushed the pulls/6.0/searchcontext-confusion branch from a83de6e to 34e8730 Compare January 8, 2025 01:11
* @param array|bool|string $sort Field to sort on.
* @param array|false|string $sort Field to sort on.
Copy link
Member Author

Choose a reason for hiding this comment

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

true isn't a valid value for $sort so I changed this to explicitly false. Not strong-typing here because the main focus of this PR is the $limit param.

Seems the two search context implementations had different ideas about
what was correct for the limit parameter, and the basic one wasn't even
handling the values correctly.
@GuySartorelli GuySartorelli force-pushed the pulls/6.0/searchcontext-confusion branch from 34e8730 to e50188c Compare January 8, 2025 01:49
@GuySartorelli GuySartorelli marked this pull request as ready for review January 8, 2025 02:04
@emteknetnz emteknetnz merged commit a3b9a82 into silverstripe:6.0 Jan 8, 2025
13 checks passed
@emteknetnz emteknetnz deleted the pulls/6.0/searchcontext-confusion branch January 8, 2025 04:26
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