예제 #1
0
 /**
  * 获取问题
  */
 public function getQuestion()
 {
     return $this->hasOne(Question::className(), ['id' => 'pid']);
 }
예제 #2
0
파일: User.php 프로젝트: rocketyang/huajuan
 /**
  * 获取用户发表的问题
  * @return \yii\db\ActiveQuery
  */
 public function getQuestion($id)
 {
     return $this->hasOne(Question::className(), ['author_id' => 'id'])->andWhere(['id' => $id]);
 }