diff options
author | xue <> | 2007-11-19 21:27:37 +0000 |
---|---|---|
committer | xue <> | 2007-11-19 21:27:37 +0000 |
commit | 0450afdd1b514e10e1adba2efac00e57637f6854 (patch) | |
tree | 5693658acc0cb6d85893e5ed33b8394d7dd88c3c /framework/Data | |
parent | d016473823529ecc34189bd359b69ec978b6711b (diff) |
added TActiveRecord::getActiveDbConnection.
Diffstat (limited to 'framework/Data')
-rw-r--r-- | framework/Data/ActiveRecord/TActiveRecord.php | 10 |
1 files changed, 9 insertions, 1 deletions
diff --git a/framework/Data/ActiveRecord/TActiveRecord.php b/framework/Data/ActiveRecord/TActiveRecord.php index 58c168db..2bdba2d1 100644 --- a/framework/Data/ActiveRecord/TActiveRecord.php +++ b/framework/Data/ActiveRecord/TActiveRecord.php @@ -289,6 +289,14 @@ abstract class TActiveRecord extends TComponent $this->setColumnValue($name,$value); } + + public static function getActiveDbConnection() + { + if(($db=self::getRecordManager()->getDbConnection())!==null) + $db->setActive(true); + return $db; + } + /** * Gets the current Db connection, the connection object is obtained from * the TActiveRecordManager if connection is currently null. @@ -297,7 +305,7 @@ abstract class TActiveRecord extends TComponent public function getDbConnection() { if($this->_connection===null) - return self::getRecordManager()->getDbConnection(); + $this->_connection=self::getActiveDbConnection(); return $this->_connection; } |