Skip to content

[Feature Request] Eager-loaded collections should use the same API as non-eager-loaded ones #8513

Closed Answered by brandonkelly
benface asked this question in Ideas
Discussion options

You must be logged in to vote

Just resolved this for Craft 4. Now eager-loaded elements are returned as a Collection, and element queries have a new collect() method, which returns the query results as a Collection rather than an array. So if you want a consistent API, just get in the habit of calling collect() instead of all().

See #9755 for more details.

Replies: 3 comments

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
0 replies
Answer selected by brandonkelly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Ideas
Labels
enhancement improvements to existing features site development 👩‍💻 features related to website/API development
3 participants
Converted from issue

This discussion was converted from issue #2549 on June 22, 2021 06:20.