コード例 #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
 /**
  * Finds the Institute model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @return Institute the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id)
 {
     if (($model = Institute::findOne($id)) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }