关于关联模型

浏览:411 发布日期:2013/07/21 分类:求助交流
初学TS,还望赐教~
两张表:
pre_user : id username dept
pre_user_dept:id deptname
我在user的model里面这么写的protected $_link = array(  //定义关联模型
            'Dept'=> array(  
            'mapping_type'=>BELONGS_TO,
            'class_name'=>'UserDept',
            'foreign_key'=>'dept',
            'mapping_name'=>'UserDept',
            ),
         );
user的action里面这么写的$list=$User->where($condition)->relation('Dept')->select();求高手指点问题出在哪里。。。谢谢了~
最佳答案
评论( 相关
后面还有条评论,点击查看>>