/**
  * Returns the database connection used by active record.
  * By default, the "db" application component is used as the database connection.
  * You may override this method if you want to use a different database connection.
  * 
  * @return CDbConnection the database connection used by active record.
  */
 public function getDbConnection()
 {
     if (self::$db !== null) {
         return self::$db;
     } else {
         self::$db = Yii::app()->getDb();
         if (self::$db instanceof CDbConnection) {
             return self::$db;
         } else {
             $message = Yii::t('packages', 'Transactional form model requires a "db" CDbConnection application component.');
             throw new CDbException($message);
         }
     }
 }