public function actionView($type, $uid)
 {
     /** @var Article $contentModel */
     $contentModel = Article::findOne($uid);
     if (!$contentModel) {
         throw new NotFoundHttpException();
     }
     return $this->render('view', ['contentModel' => $contentModel]);
 }
 public function actionDelete($id)
 {
     $model = Article::findOne($id);
     $model->delete();
     return $this->redirect(['index', 'type' => $model->type]);
 }
Ejemplo n.º 3
0
 public static function getClassName($id)
 {
     $map = [self::NEWS => Article::className(), self::ARTICLE => Article::className()];
     return isset($map[$id]) ? $map[$id] : null;
 }