Skip to content

[5.x] vs [4.x:] [Docs] Eager loading documentation differences #661

@rob-c-baker

Description

@rob-c-baker

Description

When you look at this (v4): https://craftcms.com/docs/4.x/dev/eager-loading-elements.html

vs this (v5): https://craftcms.com/docs/5.x/development/eager-loading.html

The v4 docs talk about elements related to matrix blocks and use an example like this:

{% set entries = craft.entries()
  .section('news')
  .with(['matrixField.blockType:assetsField'])
  .all() %}

Note the use of :.

When picking through the source code of v5 it looks like this, or something like it is still in the source code but not mentioned anywhere in the v5 docs. I know matrix block types are gone in favour of entry types but it's not clear:

  • If this syntax should still work
  • If it does, I am assuming the entry type handle would go where above currently has blockType?

I'm also assuming that the field handles in with() definitions should be the field handles on the entry type and not the field handles they "extend" from on the global fields themselves (i.e. with the numbers appended - see below). Is that correct?

Context

I am working with an upgraded (not deployed yet) site where there are a large number of entry types and fields that have had numbers appended to their field handles.

It is pretty tricky working out what handles, with what particular number appended go in which spots with the eager loading definitions. Once I can get performance up to a good enough standard with the fields like this, I'm planning to do probably several passes of field merging but that cannot happen until I get the release out.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions