diff options
-rw-r--r-- | framework/Data/ActiveRecord/TActiveRecord.php | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 446c87e4..f28b81e4 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -199,9 +199,11 @@ abstract class TActiveRecord extends TComponent public function getDbConnection() { if($this->_connection===null) - $this->_connection=self::getRecordManager()->getDbConnection(); - if($this->_connection===null) //check it - throw new TActiveRecordException('ar_invalid_db_connection',get_class($this)); + { + $this->setDbConnection(self::getRecordManager()->getDbConnection()); + if($this->_connection===null) //check it + throw new TActiveRecordException('ar_invalid_db_connection',get_class($this)); + } return $this->_connection; } |