diff options
Diffstat (limited to 'framework/Data')
-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); } |