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

[5.2] Support column aliases in chunkById #14711

Merged
merged 1 commit into from
Aug 12, 2016
Merged

[5.2] Support column aliases in chunkById #14711

merged 1 commit into from
Aug 12, 2016

Conversation

mzur
Copy link
Contributor

@mzur mzur commented Aug 9, 2016

This is a follow-up on #14499 where chunkById should be fixed to support more complex queries. The following query currently does not work:

// both the annotations and images tables have an id column
DB::table('annotations')
   ->join('images', 'annotations.image_id', '=', 'images.id')
   ->where(/* something with images */)
   ->chunkById(500, $handleChunk, 'annotations.id');

With this PR it can be done like this:

DB::table('annotations')
   ->join('images', 'annotations.image_id', '=', 'images.id')
   ->where(/* something with images */)
   ->select('annotations.id as annotations_id', /* ... */)
   ->chunkById(500, $handleChunk, 'annotations.id', 'annotations_id');

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