In looking at the the BaseElementModel:getDescendants()
method and saw it checks for eager loading elements named 'descendants.'
// Eager-loaded?
if ($this->hasEagerLoadedElements('descendants'))
{
return $this->getEagerLoadedElements('descendants');
}
I added with
and the descendants
condition to a Structure and the page is now loading with a few less queries.
{% set entries = craft.entries({
section: 'sectionHandle',
limit: null,
with: [
'descendants'
]
}) %}
Can anybody explain what is happening here?