public function actionList($type)
 {
     $item = new Article();
     $typeId = Article::getTypeIdByAlias($type);
     if (!$typeId) {
         throw new HttpException(404, 'Категория статей не найдена');
     }
     $item->type = $typeId;
     $items = Article::find()->type($type)->all();
     return $this->render('list', ['items' => $items, 'item' => $item]);
 }
Example #2
0
 public function type($type)
 {
     $typeId = Article::getTypeIdByAlias($type);
     $this->where(['type' => $typeId]);
     return $this;
 }