我试图为一组特别用户建立一个单独的数据库,这些用户将通过一个Yi模块进入我的网站,但我似乎无法正确掌握配置。
Here are the relevant files my module heirarchy.
/protected/modules/special
/protected/modules/special/SpecialModule.php
/protected/modules/special/models/SpecialActiveRecord.php
/protected/modules/special/models/Account.php
/protected/modules/special/components/UserIdentity.php
Per instructions here, I ve updated my main.config to include a module specific database definition.
modules =>array(
special =>array(
db =>array(
connectionString => mysql:dbname=specialdatabase ,
username => special ,
password => special ,
),
),
),
我还更新了我的模块,以支持数据库定义,将<代码>公开
class SpecialActiveRecord extends CActiveRecord
{
public function getDbConnection()
{
$db = Yii::app()->controller->module->db;
return Yii::createComponent($db);
}
}
Where I m having trouble is in the account model. My primary web application also implements an account model and the stack trace shows that the module is accessing all of my module specific files through user identity (/protected/modules/special/components/UserIdentity.php
). The account model that is being used for authorization, however, is referenced at the site level (/protected/models/Account.php
).
利用模块特定数据库实施模块具体认证的适当方法的任何想法?