예제 #1
0
 public function getInstitute()
 {
     if ($this->course_id != NULL) {
         $institute_id = Course::find()->select(['institute_id'])->where(['id' => $this->course_id])->one()->institute_id;
         $institute = Institute::findOne(['id' => $institute_id]);
         return $institute;
     }
 }
예제 #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourses()
 {
     return $this->hasMany(Course::className(), ['institute_id' => 'id']);
 }
예제 #3
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourses()
 {
     return $this->hasMany(Course::className(), ['id' => 'course_id'])->viaTable('user_has_course', ['user_id' => 'id']);
 }
예제 #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getCourse()
 {
     return $this->hasOne(Course::className(), ['id' => 'course_id']);
 }