示例#1
0
 /**
  * Establishing hasOne relation with Comment table
  * @return \yii\db\ActiveQuery
  */
 public function getComment()
 {
     return $this->hasMany(Comment::classname(), ['comment_country_id' => 'country_id']);
     /*Сначала ключ другой таблицы, потом своей*/
 }