public function testGetCategories() { $categories = $this->categoryModel->getCategories(); foreach ($categories->models as $category) { $this->assertInstanceOf('common\\models\\Category', $category); } }
/** * Просмотр списка постов по тегу * @param $id * @return string */ public function actionView($id) { $tagModel = new Tags(); $tag = $tagModel->getTag($id); $categoryModel = new Category(); return $this->render('view', ['tag' => $tag, 'posts' => $tag->getTagPosts(), 'categories' => $categoryModel->getCategories()]); }
/** * Список постов. * @return string */ public function actionIndex() { $post = new Post(); $category = new Category(); return $this->render('index', ['posts' => $post->getPublishedPosts(), 'categories' => $category->getCategories()]); }
public function init() { parent::init(); $this->categoryArr = Category::getCategories(); }
public function actionView($id) { $categoryModel = new Category(); $category = $categoryModel->getCategory($id); return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]); }