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 a many-to-many relation? #27

Open
bertheyman opened this issue Apr 2, 2019 · 0 comments
Open

How to eager load a many-to-many relation? #27

bertheyman opened this issue Apr 2, 2019 · 0 comments

Comments

@bertheyman
Copy link

bertheyman commented Apr 2, 2019

I've a many-to-many relation set up. I've tried two approaches to work with eager loading, but can't figure it out.

  1. This approach works, but not sure how I can apply eager loading for this:
craft.entries.section('relatedSection').relatedTo(entry).all()
// Result ok but doesn't pair with eager loading
  1. But have trouble with this one, while this might support eager loading:
entry.relatedSectionFieldName
// Result empty

For the regular relation, this last approach does work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants