-
Notifications
You must be signed in to change notification settings - Fork 11.2k
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
[5.3] Unify join and builder syntax #13576
Conversation
Would there be any issues with using methods available on |
They will be ignored, same as with nested where... Currently nothing is stopping you from writing: User::where(function($query){
$query->orderBy('foo');
})->get(); I first wanted to extract the where builder in a separate class and use it for nested wheres & joins, but it would make merging 5.2 -> 5.3 a nightmare. The only problem is if you introduce non-where bindings - the query would fail in both cases. |
Totally agree with @acasar in this regard. Seems a really good feature to have in 5.3 |
@@ -506,7 +506,7 @@ public function testHasWithContraintsAndJoinAndHavingInSubquery() | |||
$builder = $model->where('bar', 'baz'); | |||
$builder->whereHas('foo', function ($q) { | |||
$q->join('quuuux', function ($j) { | |||
$j->on('quuuuux', '=', 'quuuuuux', 'and', true); | |||
$j->where('quuuuux', '=', 'quuuuuux'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you need to change this test?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The last param (true) was removed from the on
clause since it no longer makes sense.
Looks good. Thanks! |
I documented some minor breaking changes from laravel/framework#13576
This is a massive cleanup of the join clause (~200 lines of production code removed). The idea is to extend the query builder and reuse its functionality instead of duplicating it. This has multiple benefits:
whereRaw
,whereSub
, ...)The only breaking change is the removal of
$where
boolean parameter in theon
clause and the removal of some publicJoinClause
properties.