Yii Framework Forum: Yii2 如何实现Many_Many - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Yii2 如何实现Many_Many Rate Topic: -----

#1 User is offline   sharehua 

  • Advanced Member
  • PipPipPip
  • Yii
  • Group: Members
  • Posts: 456
  • Joined: 30-December 08

Posted 13 September 2014 - 01:52 AM

YII2 如何实现 yii1的以下代码?

'receiverList'=>array(self::MANY_MANY, 'User', '_general_messagesend_receiver_link(messageSend_id, receiver_id)'),
			'countKnow'=>array(self::STAT,'MessageReceive','messageSendId','condition'=>'isKnow=1'),

YII2 技术群【QQ群--146409855】,欢迎朋友,拒绝过客
0

#2 User is offline   notYet 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 6
  • Joined: 20-May 12

Posted 29 October 2014 - 01:11 AM

http://stuff.cebe.cc...ive-record.html

# Relations with Junction Table
0

#3 User is offline   wutong 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 3
  • Joined: 29-October 13

Posted 29 July 2015 - 12:18 AM

public function getReceiverList(){
    return self::hasMany(User::className(),['id'=>'receiver_id'])->viaTable('_general_messagesend_receiver_link',['messageSend_id'=>'id'])->where("isKnow=1");
}

0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users