You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
$instances = Loader::from($instances, ['relationshipAlias']);
foreach($instancesas$instance) {
print_r($instance->getRelationshipAlias());
}
// on the model for $instance I havepublicfunctiongetRelationshipAlias() {
if(!isset($this->_related['relationshipAlias']) || $this->_related['relationshipAlias'] === null) {
// get from cache or fetch from db using getRelated('relationshipAlias');
}
}
The problem here is that on that case, the eagerloaded relationships are wasted. Of course, if I try to check if the relationship is loaded using the property relationshipAlias, in case that the relationship is not loaded it will make a lazy loading "automatically", runining my chance to insert the caché.
The text was updated successfully, but these errors were encountered:
Surt
added a commit
to Surt/incubator
that referenced
this issue
Apr 6, 2017
When using relationships lazy loading along with magic "getPropertyName" methods the relationships are lazy loaded without having the eager load in consideration. This patch fix it.
References: stibiumz/phalcon.eager-loading#12
Hi, I was taking a look at
https://github.com/stibiumz/phalcon.eager-loading/blob/master/src/EagerLoading/EagerLoad.php#L157
the property
_related
where the relationships are stored is not filled.This is causing me a problem. When I want to check if a relationship is already loaded, (by any way) if not, then I check caché or fetch db.
On pseudocode:
The problem here is that on that case, the eagerloaded relationships are wasted. Of course, if I try to check if the relationship is loaded using the property
relationshipAlias
, in case that the relationship is not loaded it will make a lazy loading "automatically", runining my chance to insert the caché.The text was updated successfully, but these errors were encountered: