Example #1
0
 public function testGetCategories()
 {
     $categories = $this->categoryModel->getCategories();
     foreach ($categories->models as $category) {
         $this->assertInstanceOf('common\\models\\Category', $category);
     }
 }
Example #2
0
 /**
  * Просмотр списка постов по тегу
  * @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()]);
 }
Example #3
0
 /**
  * Список постов.
  * @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();
 }
Example #5
0
 public function actionView($id)
 {
     $categoryModel = new Category();
     $category = $categoryModel->getCategory($id);
     return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]);
 }