An EagerRelation
object temporarily stores the models from an eager load,
and handles matching eager loaded objects with their parent(s). The tempModel
is only used to retrieve the value of the relation method, to know the constrains
for the eager query.
Handles an eager loaded fetch, passing the name of the item we're fetching for, and any options needed for the current fetch.
skip eager loading for rows where the foreign key isn't set
Call the function, if one exists, to constrain the eager loaded query.
Special handler for the eager loaded morph-to relations, this handles the fact that there are several potential models that we need to be fetching against. pairing them up onto a single response for the eager loading.
Handles the eager load for both the morphTo
and regular cases.
If there is a response, fetch additional nested eager relations, if any.
If this is a morphTo
relation, we need to do additional processing
to ensure we don't try to load any relations that don't look to exist.
Filters the withRelated
on a morphTo
relation, to ensure that only valid
relations are attempted for loading.
By this point, all withRelated should be turned into a hash, so it should be fairly simple to process by splitting on the dots.
EagerRelation