summaryrefslogtreecommitdiff
path: root/framework/Data/ActiveRecord/Relations
diff options
context:
space:
mode:
authorwei <>2007-05-01 03:19:30 +0000
committerwei <>2007-05-01 03:19:30 +0000
commit419f0815c85a40639ac82c1ce05c80186a64dc55 (patch)
treee875e519451b617a822bece75e24d23d3b93236e /framework/Data/ActiveRecord/Relations
parent595a0acc2554da4c4c52f065dc76893c241f2624 (diff)
remove identity map in active record.
Diffstat (limited to 'framework/Data/ActiveRecord/Relations')
-rw-r--r--framework/Data/ActiveRecord/Relations/TActiveRecordHasManyAssociation.php17
1 files changed, 5 insertions, 12 deletions
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