From dbb73305b29a8cc3b160688e8977049af785ab32 Mon Sep 17 00:00:00 2001 From: xue <> Date: Sat, 13 Oct 2007 01:48:28 +0000 Subject: Active Record now supports implicitly declared related properties --- .../Data/ActiveRecord/Relations/TActiveRecordRelation.php | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) (limited to 'framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php') diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php index 8e9cc9b5..5bde4898 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordRelation.php @@ -41,7 +41,7 @@ abstract class TActiveRecordRelation { return $this->_context; } - + /** * @return TActiveRecordCriteria */ @@ -58,6 +58,8 @@ abstract class TActiveRecordRelation return $this->getContext()->getSourceRecord(); } + abstract protected function collectForeignObjects(&$results); + /** * Dispatch the method calls to the source record finder object. When * an instance of TActiveRecord or an array of TActiveRecord is returned @@ -85,7 +87,7 @@ abstract class TActiveRecordRelation array_push($stack,$this); //call it later return $results; } - + /** * Fetch results for current relationship. * @return boolean always true. @@ -125,13 +127,13 @@ abstract class TActiveRecordRelation throw new TActiveRecordException('ar_relations_missing_fk', $tableInfo->getTableFullName(), $matching); } - + /** * @return array foreign key field names as key and object properties as value. - * @since 3.1.2 + * @since 3.1.2 */ abstract public function getRelationForeignKeys(); - + /** * Find matching foreign key fields from the 3rd element of an entry in TActiveRecord::$RELATION. * Assume field names consist of [\w-] character sets. Prefix to the field names ending with a dot @@ -238,7 +240,7 @@ abstract class TActiveRecordRelation { $hash = $this->getObjectHash($source, $properties); $prop = $this->getContext()->getProperty(); - $source->setColumnValue($prop, isset($collections[$hash]) ? $collections[$hash] : array()); + $source->$prop=isset($collections[$hash]) ? $collections[$hash] : array(); } } -- cgit v1.2.3