Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to eager load relations? #119

Open
maxi032 opened this issue Feb 3, 2023 · 4 comments
Open

How to eager load relations? #119

maxi032 opened this issue Feb 3, 2023 · 4 comments
Labels
wontfix This will not be worked on

Comments

@maxi032
Copy link

maxi032 commented Feb 3, 2023

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

@ryanmitchell
Copy link
Contributor

At the moment with() doesn't do anything in the Eloquent Entry Query builder.

See:

public function with($relations, $callback = null)

@maxi032
Copy link
Author

maxi032 commented Feb 3, 2023

I thought so... this takes away one of the greatest advantages of using Laravel, the fact that I can load related content basically on the fly.

@ryanmitchell ryanmitchell added the wontfix This will not be worked on label Jun 14, 2023
@de-raaf-media
Copy link

I am experiencing large performance issues with taxonomies. I now see that "with" is not implemented. This is not going to be implemented?

@ryanmitchell
Copy link
Contributor

There are no plans to implement it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
wontfix This will not be worked on
Projects
None yet
Development

No branches or pull requests

3 participants