【发布时间】:2015-03-11 01:59:29
【问题描述】:
我有一个问题
Yii::app()->getModule('user') is not returning the right value view/layout/main.php
但我有一个不同的情况,我无法对其进行树脂安装,并且使用了右扩展。 在主配置中
'application.models.*',
'application.components.*',
'application.modules.rights.*',
'application.modules.rights.components.*',
'rights'=>array(
'superuserName'=>'Admin', // Name of the role with super user privileges.
'authenticatedName'=>'Authenticated', // Name of the authenticated user role.
'userIdColumn'=>'id', // Name of the user id column in the database.
'userNameColumn'=>'username', // Name of the user name column in the database.
'enableBizRule'=>true, // Whether to enable authorization item business rules.
'enableBizRuleData'=>false, // Whether to enable data for business rules.
'displayDescription'=>true, // Whether to use item description instead of name.
'flashSuccessKey'=>'RightsSuccess', // Key to use for setting success flash messages.
'flashErrorKey'=>'RightsError', // Key to use for setting error flash messages.
'install'=>false, // Whether to enable installer.
'debug'=>false, // Whether to enable debug mode.
),
然后我需要更新此应用程序以使用用户扩展.. 我正在尝试,结果是:
Trying to get property of non-object
<?php $this->widget('zii.widgets.CMenu',array(
'items'=>array(
array('url'=>Yii::app()->getModule('user')->loginUrl, 'label'=>Yii::app()->getModule('user')->t("Login"), 'visible'=>Yii::app()->user->isGuest),
现在我得到了不同的错误:
Trying to get property of non-object
public function tableName()
{
return Yii::app()->getModule('user')->tableUsers;
}
在\protected\modules\user\models\User.php(41)中
我在 config main 中的代码更新如下:
'modules'=>array(
'user'=>array(
'tableUsers' => 'tbl_users',
'tableProfiles' => 'tbl_profiles',
'tableProfileFields' => 'tbl_profiles_fields',
知道我的错在哪里吗? *对不起,如果我语法不好。
【问题讨论】:
标签: yii yii-extensions