diff options
author | xue <> | 2007-10-13 11:27:42 +0000 |
---|---|---|
committer | xue <> | 2007-10-13 11:27:42 +0000 |
commit | d836550f3a36e09c3b491f6b6254172ecd2fee06 (patch) | |
tree | 98f04691631456343d4cfecda6d590c39d0f9e4a /framework | |
parent | cc0b1e31584bb14a8715b0953cc9336fd4640d78 (diff) |
fixed belongs_to.
Diffstat (limited to 'framework')
-rw-r--r-- | framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php | 2 | ||||
-rw-r--r-- | framework/Data/ActiveRecord/TActiveRecord.php | 8 |
2 files changed, 3 insertions, 7 deletions
diff --git a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php index 805739c1..c030f2d2 100644 --- a/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php +++ b/framework/Data/ActiveRecord/Relations/TActiveRecordBelongsTo.php @@ -111,6 +111,8 @@ class TActiveRecordBelongsTo extends TActiveRecordRelation throw new TActiveRecordException('ar_belongs_to_multiple_result');
$source->$prop=$collections[$hash][0];
}
+ else
+ $source->$prop=null;
}
/**
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index b8ff57f9..0b892a8f 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -205,13 +205,7 @@ abstract class TActiveRecord extends TComponent $name2=strtolower($name); if(!isset($this->_foreignObjects[$name2])) $this->fetchResultsFor($name2); - if(isset($this->_foreignObjects[$name2])) - return $this->_foreignObjects[$name2]===false?null:$this->_foreignObjects[$name2]; - else - { - $this->_foreignObjects[$name2]=false; - return null; - } + return $this->_foreignObjects[$name2]===false?null:$this->_foreignObjects[$name2]; } return parent::__get($name); } |