예제 #1
0
 /**
  * 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.
  */
 public function loadModel()
 {
     if ($this->model === null) {
         if (Yii::$app->request->get('id')) {
             $this->model = ProfileField::findOne(Yii::$app->request->get('id'));
         }
         if ($this->model === null) {
             throw new NotFoundHttpException('The requested page does not exist.');
         }
     }
     return $this->model;
 }