Example #1
0
 /**
  * Возвращает список возможных категорий товара.
  * Примечание: используется в backend/user/index представлении.
  *
  * @return mixed
  */
 public static function getCategoryList()
 {
     $categories = [];
     foreach (Category::getCategory() as $item_name) {
         $categories[$item_name->id] = $item_name->name;
     }
     return $categories;
 }
Example #2
0
 /**
  * @expectedException \yii\web\NotFoundHttpException
  */
 public function testGetCategoryNotFound()
 {
     $this->assertInstanceOf('common\\models\\Category', $this->categoryModel->getCategory(-1));
 }
Example #3
0
 public function actionView($id)
 {
     $categoryModel = new Category();
     $category = $categoryModel->getCategory($id);
     return $this->render('index', ['category' => $category, 'posts' => $category->getPosts(), 'categories' => $categoryModel->getCategories()]);
 }