/**
  * Returns the data model based on the primary key given in the GET variable.
  * If the data model is not found, an HTTP exception will be raised.
  * @param integer the ID of the model to be loaded
  * @throws CHttpException
  * @return $model Object
  */
 public function loadModel($id)
 {
     $model = Section::findOne($id);
     if ($model === null) {
         throw new HttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Example #2
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getSection()
 {
     return $this->hasOne(Section::className(), ['SectionId' => 'SectionId']);
 }
 /**
  * Returns a list of all Section name
  * @return $sectionList array
  */
 private function getSectionList()
 {
     $sections = Section::find()->all();
     $sectionList = array();
     if (!empty($sections)) {
         foreach ($sections as $section) {
             $sectionList[$section->SectionId] = $section->sectionTexts ? Html::encode($section->sectionTexts[0]->Name) : '';
         }
     }
     return $sectionList;
 }