关联模型 关联条件condition问题

浏览:2098 发布日期:2013/03/12 分类:求助交流
我想在用户列表上显示 用户所属用户组
用了 user表 和 rbac_role表action:
$this->DB = D('User');
$list = $this->DB->relation(true)->select();


model:
class UserModel extends RelationModel {

    protected $_link = array(
        'RbacRole' => array(
            'mapping_type' => BELONGS_TO,
            'foreign_key' => 'id',
            'as_fields'=>'name',
            'mapping_name' => 'RbacRole',
            'condition' => 'User.role_id = RbacRole.id'
        ),
    );
}
我的model是不是错了呢~ 请指教一下~
最佳答案
评论( 相关
后面还有条评论,点击查看>>