Skip to content

How to eager load relations? #119

@maxi032

Description

@maxi032

I try to load a page and the associated taxonomies terms of it but the problem is that extra queries are being done.
I am using Statamic multisite.
I would like to be able to eager load only those associated with that specific entry.
So I have a tags taxonomy and I want something like:

$queryBuilder = Entry::with(['tags'])->query()
->where('collection','pages')
->where('slug', 'my-page')
->where('site', 'en');
->where('published', true)->get();

Many thanks

Metadata

Metadata

Assignees

No one assigned

    Labels

    wontfixThis will not be worked on

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions