Skip to content

How to lazy load nested relationship? #104

Closed Answered by rubenvanassche
benjivm asked this question in Q&A
Discussion options

You must be logged in to vote

Hi @benjivm,

At the moment we do not have support for this kind of checking. This is actually also quire complicated to achieve. In the case of simple relations with a 1:1 mapping there's no problem.

For example if foo.bar is requested, we first check if foo is loaded on our model and then we check if bar is loaded on foo. If that's the case the lazy closure can be executed. But as soon as we add relations with multiple models to the mix we start to get in trouble.

For example let say the foo relation is actually a collection of model, now we need to check if each bar relation is loaded on all the foo models.

In this case I would opt for using a conditional Lazy where you write the condit…

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@thewebartisan7
Comment options

Answer selected by benjivm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants