From 0450afdd1b514e10e1adba2efac00e57637f6854 Mon Sep 17 00:00:00 2001 From: xue <> Date: Mon, 19 Nov 2007 21:27:37 +0000 Subject: added TActiveRecord::getActiveDbConnection. --- framework/Data/ActiveRecord/TActiveRecord.php | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) (limited to 'framework/Data/ActiveRecord/TActiveRecord.php') 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; } -- cgit v1.2.3