From 909dba0d1b1787a75bb88d84a5b1bd95220f6a8e Mon Sep 17 00:00:00 2001 From: Kaste Date: Wed, 23 Jul 2008 02:21:10 +0000 Subject: [PATCH] Refactor. Moved logic from findBySqlWithAssociations to ->_generateObjectGraphFromResultSet. 'A chance to refactor and improve this.' git-svn-id: http://svn.akelos.org/trunk@928 a2fa5c27-f921-0410-a72c-bf682d381be0 --- lib/AkActiveRecord/AkAssociatedActiveRecord.php | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/lib/AkActiveRecord/AkAssociatedActiveRecord.php b/lib/AkActiveRecord/AkAssociatedActiveRecord.php index ec3523a..4ce84cd 100644 --- a/lib/AkActiveRecord/AkAssociatedActiveRecord.php +++ b/lib/AkActiveRecord/AkAssociatedActiveRecord.php @@ -342,6 +342,21 @@ class AkAssociatedActiveRecord extends AkBaseModel if (!$results){ return $objects; } + $result =& $this->_generateObjectGraphFromResultSet($results,$included_associations,$virtual_limit); + return $result; + } + + /** + * Pass hand-made sql directly to _db->execute and generate the OG with this method. + * + * @param ADOResultSet $results a result set from Db->execute + * @param array $included_associations just like in ->find(); $options['include']; but in fact unused + * @param mixed $virtual_limit int or false; unsure if this works + * @return array ObjectGraph as an array + */ + function &_generateObjectGraphFromResultSet($results,$included_associations = array(), $virtual_limit = false) + { + $objects = array(); $i = 0; $associated_ids = $this->getAssociatedIds(); -- 2.11.4.GIT