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.4] Enforce an orderBy clause for chunk() and chunkById() #16283

Merged
merged 2 commits into from
Nov 8, 2016
Merged

[5.4] Enforce an orderBy clause for chunk() and chunkById() #16283

merged 2 commits into from
Nov 8, 2016

Conversation

vlakoff
Copy link
Contributor

@vlakoff vlakoff commented Nov 6, 2016

Just a first insight. Before this is merged, latest 5.3 changes should have been merged into master, then this PR will have to be updated.

Follow-up to #11623.
orderBy clause is already enforced for each, it just makes sense to enforce it in chunk and chunkById as well. User code may work with this clause omitted, but that's damn dangerous and prone to future errors.

By the way, an interesting article on the subject: Paging Through Results.

@taylorotwell
Copy link
Member

Generally seems OK to me. Latest 5.3 has been merged to master.

@vlakoff
Copy link
Contributor Author

vlakoff commented Nov 8, 2016

Rebased. 🙋‍♀️

@taylorotwell taylorotwell merged commit 8eb7f55 into laravel:master Nov 8, 2016
@vlakoff vlakoff deleted the enforceOrderBy branch November 9, 2016 04:21
@vlakoff
Copy link
Contributor Author

vlakoff commented Nov 17, 2016

I have a doubt:

In the query builder, enforceOrderBy() can throw a RuntimeException and as such has a @throws in docblock.

chunk() etc. call enforceOrderBy(), should they have the @throws docblock too?

ping :) @GrahamCampbell

@vlakoff
Copy link
Contributor Author

vlakoff commented Nov 22, 2016

Just submitted #16513 to bring a fix to this PR.

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