From 419f0815c85a40639ac82c1ce05c80186a64dc55 Mon Sep 17 00:00:00 2001 From: wei <> Date: Tue, 1 May 2007 03:19:30 +0000 Subject: remove identity map in active record. --- .../Relations/TActiveRecordHasManyAssociation.php | 17 +++++------------ 1 file changed, 5 insertions(+), 12 deletions(-) (limited to 'framework/Data/ActiveRecord/Relations') diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php index bb2cc583..456848fe 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php @@ -73,6 +73,8 @@ class TActiveRecordHasManyAssociation extends TActiveRecordRelation { $criteria = $this->getContext()->getCriteria(); $finder = $this->getContext()->getForeignRecordFinder(); + $registry = $finder->getRecordManager()->getObjectStateRegistry(); + $type = get_class($finder); $command = $this->createCommand($criteria, $foreignKeys,$indexValues,$sourceKeys); $srcProps = array_keys($sourceKeys); $collections=array(); @@ -81,22 +83,13 @@ class TActiveRecordHasManyAssociation extends TActiveRecordRelation $hash = $this->getObjectHash($row, $srcProps); foreach($srcProps as $column) unset($row[$column]); - $collections[$hash][] = $this->populateObject($finder, $row); + $obj = new $type($row); + $collections[$hash][] = $obj; + $registry->registerClean($obj); } $this->setResultCollection($results, $collections, array_values($sourceKeys)); } - - protected function populateObject($finder, $data) - { - $registry = $finder->getRecordManager()->getObjectStateRegistry(); - if(!is_null($obj = $registry->getCachedInstance($data, false))) - return $obj; - $gateway = $finder->getRecordManager()->getRecordGateway(); - $type = get_class($finder); - $obj = new $type($data); - return $registry->addCachedInstance($data,$obj); - } /** * @param TSqlCriteria -- cgit v1.2.3