yii2关联查询两组一对一

    public function getMember1(){
        return $this->hasOne(Member::className(), ['wechat_id' =>'toid']);
    }

    public function getMember2(){
        return $this->hasOne(Member::className(), ['wechat_id' =>'fromid']);
    }

 

            [
            'label' => '【上司】',
            'value' =>$model->member1->name
            ],
            [
            'label' => '反馈者',
            'value' =>$model->member2->name
            ],

posted @ 2017-03-21 12:16  岁月静好13543  阅读(477)  评论(0编辑  收藏  举报
AmazingCounters.com