Skip to content

Add Collection ids macro #12113

Closed Answered by brandonkelly
Anubarak asked this question in Ideas
Oct 13, 2022 · 1 comments · 5 replies
Discussion options

You must be logged in to vote

Made this possible for Craft 4.3 via #12140.

Little more complicated than adding a new macro since we can’t assume every collection is going to contain items that have an id key/property.

Instead I added a new craft\elements\ElementCollection class, which ElementQuery::collect() and Element::getEagerLoadedElements() return instead of Collection.

Also went ahead and gave ElementCollection a with() method as well, so it’s now possible to eager-load nested elements after the fact, rather than having to specify everything before the element query is executed.

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@brandonkelly
Comment options

@gglnx
Comment options

@brandonkelly
Comment options

@gglnx
Comment options

@brandonkelly
Comment options

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
None yet
3 participants