Skip to content

Eager-loading and custom selects and/or query execution #16714

Closed Answered by brandonkelly
MoritzLost asked this question in Q&A
Discussion options

You must be logged in to vote

It’s only possible to eager-load (normally or lazily) entire elements, not individual values.

I’d stick with your first example. Less queries, simpler/more future-proof code, and better cachability. (By accessing category.title, a cache invalidation tag will be registered for the category, so any surrounding {% cache %} tags, etc., will be cleared whenever the category is updated.)

Replies: 1 comment 7 replies

Comment options

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

@mmikkel
Comment options

@MoritzLost
Comment options

@brandonkelly
Comment options

@MoritzLost
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
Q&A
Labels
None yet
3 participants