-
-
Notifications
You must be signed in to change notification settings - Fork 600
[5.x] Add whereInId to EntryRepository #11668
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.x] Add whereInId to EntryRepository #11668
Conversation
938890e to
434e627
Compare
|
Apologies, I might be misunderstanding this change, but why can't you do |
|
No worries at all. You certainly can do that, but it won't:
|
…Collections. Comment out from interface because it would be breaking.
|
Thanks for your patience. I've made a couple of changes:
At first I was going to suggest that |
|
All sounds perfect. Good catch on the |
This PR adds
findByIdsto theEntryRepositorycontract and Stache implementation. See docs PR.Entries are returned in order of their id's position in the original input argument. Missing IDs are omitted from resultant collection.
Relavancy to other packages
This is part of a wider piece of work I've start to add a fairly large reduction in DB queries to the
statamic/eloquent-driver. The principal idea is to route as many components as possible through the repositories. In doing so we can optimise to load directly from the Blink cache, and only defer to the QueryBuilder when we’re missing items.As I was adding this to the Eloquent Driver package, parity with the core Repository contract felt good as well.
Future considerations
A future goal would be to see the Entries fieldtype use this method and manage the published statuses itself. This could mean we have more occasion to use the blink cache in the eloquent driver solution and also benefit from eager loading see nadinengland/statamic-eloquent-driver#1.
However, this would certainly too much of a breaking change for 5.x, if even desired at all by your team. In the meantime I can just override the behaviour in my projects, but it may be helpful to highlight that approach here for context: