From 397e81f7abc5dc926d1606ad92dfc557c3e20c9f Mon Sep 17 00:00:00 2001 From: Gilles FELIX Date: Wed, 2 Oct 2013 15:50:52 +0200 Subject: [PATCH] Query hydrate: update_original_relation only for relations concerned --- classes/query.php | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/classes/query.php b/classes/query.php index 50c9fa8d8..21fb8675b 100644 --- a/classes/query.php +++ b/classes/query.php @@ -1115,6 +1115,7 @@ public function hydrate(&$row, $models, &$result, $model = null, $select = null, // start fetching relationships $rel_objs = $obj->_relate(); + $relations_updated = array(); foreach ($models as $m) { // when the expected model is empty, there's nothing to be done @@ -1122,6 +1123,7 @@ public function hydrate(&$row, $models, &$result, $model = null, $select = null, { continue; } + $relations_updated[] = $m['rel_name']; // when not yet set, create the relation result var with null or array if ( ! array_key_exists($m['rel_name'], $rel_objs)) @@ -1142,7 +1144,7 @@ public function hydrate(&$row, $models, &$result, $model = null, $select = null, // attach the retrieved relations to the object and update its original DB values $obj->_relate($rel_objs); - $obj->_update_original_relations(); + $obj->_update_original_relations($relations_updated); return $obj; }