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

[6.x] Improvements on subqueries #30307

Merged
merged 3 commits into from Oct 18, 2019

Conversation

@sebdesign
Copy link
Contributor

sebdesign commented Oct 16, 2019

Determine if the value is queryable

This method allows the query builder to check if a value is queryable and can be used to perform subqueries.

Those checks were performed in 4 different places in the query builder so the repetition is now extracted to a single method.

Add more context about invalid subqueries

The valid values for performing subqueries are query builder instances, closures and strings.

If the value is not one of the above, an InvalidArgumentException was thrown without any message. I've added a sensible message, and also some @throws docblock tags to the affected methods.

I've also added some tests that confirm these methods can indeed throw exceptions when misused.

sebdesign added 2 commits Oct 16, 2019
This method allows the query builder to check if a value is queryable and can be used to perform subqueries.

Those checks were performed in 4 different places in the query builder so the repetition is now extracted to a single method.
The valid values for performing subqueries are query builder instances, closures and strings.

If the value is not one of the above, an InvalidArgumentException was thrown without any message. I've added a sensible message, and also some `@throws` docblock tags to the affected methods.

I've also added some tests that confirm these methods can indeed throw exceptions when misused.
@GrahamCampbell GrahamCampbell changed the title Improvements on subqueries [6.x] Improvements on subqueries Oct 16, 2019
@sebdesign

This comment has been minimized.

Copy link
Contributor Author

sebdesign commented Oct 17, 2019

@driesvints I've removed the @throws docblock tags.

@taylorotwell taylorotwell merged commit 6d06919 into laravel:6.x Oct 18, 2019
2 checks passed
2 checks passed
continuous-integration/styleci/pr The analysis has passed
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.