Beispiel #1
0
 public function actionTopic($id = null)
 {
     if ($id) {
         $model = Topic::findOne(['topic_id' => $id]);
         if ($model) {
             return $this->render('topic', ['model' => $model]);
         } else {
             return "No Id";
             //return $this->goBack();
         }
     } else {
         $str = $_GET;
         return var_dump($str);
         //return $this->goBack();
     }
 }
 /**
  * Finds the Topic model based on its primary key value.
  * If the model is not found, a 404 HTTP exception will be thrown.
  * @param integer $id
  * @param integer $Category_id
  * @return Topic the loaded model
  * @throws NotFoundHttpException if the model cannot be found
  */
 protected function findModel($id, $Category_id)
 {
     if (($model = Topic::findOne(['id' => $id, 'Category_id' => $Category_id])) !== null) {
         return $model;
     } else {
         throw new NotFoundHttpException('The requested page does not exist.');
     }
 }