用了 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是不是错了呢~ 请指教一下~ 最佳答案