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

Default eager loading #19

Open
lachlankrautz opened this issue Feb 3, 2020 · 1 comment
Open

Default eager loading #19

lachlankrautz opened this issue Feb 3, 2020 · 1 comment

Comments

@lachlankrautz
Copy link
Contributor

Problem

Smokescreen support for nested eager loading is quite good; each relation can define multiple nested eager loads that will be passed to eloquent. However if your transformer uses nested data without includes then there needs to be way to define top level eager loading.

eg

Events check their calendar for permissions do decide what fields can show in the transformer. So even though I’m not including the calendar I need to eager load it for the permissions check.

Solution

Minor update 2.0.0 -> 2.1.0:
  • Add a new property to the transformer for default eager loads that just get merged in with the ones that resolve from requested includes
@ababkov
Copy link
Contributor

ababkov commented Feb 3, 2020

I’ve 100% needed this - will save us from putting it on the model which has felt pretty dirty (in some instances... though perfectly reasonable in others) especially given that the eager loads required may depend on the endpoint / direction that's being hit. I'm curious how this works with nested transformers (if at all).

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

No branches or pull requests

2 participants