/** * @return \yii\db\ActiveQuery */ public function getCourse() { return $this->hasOne(Course::className(), ['id' => 'course_id']); }
/** * @return \yii\db\ActiveQuery */ public function getCourses() { return $this->hasMany(Course::className(), ['institute_id' => 'id']); }
/** * @return \yii\db\ActiveQuery */ public function getCourses() { return $this->hasMany(Course::className(), ['id' => 'course_id'])->viaTable('user_has_course', ['user_id' => 'id']); }