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
Merged

Conversation

sebdesign
Copy link
Contributor

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.

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
Copy link
Contributor Author

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

@taylorotwell taylorotwell merged commit 6d06919 into laravel:6.x Oct 18, 2019
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.

3 participants