From 6e2abc1f9c3914d9a99be13c9720a4285162eaa5 Mon Sep 17 00:00:00 2001 From: Erik Wiesenthal Date: Thu, 6 Apr 2017 11:28:36 +0200 Subject: [PATCH] Update _related property so Phalcon avoids to make a lazy loading 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: https://github.com/stibiumz/phalcon.eager-loading/issues/12 --- Library/Phalcon/Mvc/Model/EagerLoading/EagerLoad.php | 1 + 1 file changed, 1 insertion(+) diff --git a/Library/Phalcon/Mvc/Model/EagerLoading/EagerLoad.php b/Library/Phalcon/Mvc/Model/EagerLoading/EagerLoad.php index 0e38a6be7..46f955b6b 100644 --- a/Library/Phalcon/Mvc/Model/EagerLoading/EagerLoad.php +++ b/Library/Phalcon/Mvc/Model/EagerLoading/EagerLoad.php @@ -163,6 +163,7 @@ public function load() if (static::$isPhalcon2) { $record->{$alias} = null; $record->{$alias} = $referencedModels; + $record->_related[$alias] = $referenceModels; } } else { $record->{$alias} = null;