Example #1
0
 public function generalAction()
 {
     $catSlug = $this->p1;
     $subCatSlug = $this->p2;
     $subCats = $this->wpRepo->fetchChildCategories($catSlug);
     if ($subCatSlug == null && $subCats != null) {
         $subCatSlug = $subCats[0]->getSlug();
         $nodeId = "{$subCatSlug}.{$catSlug}.{$this->controller}.{$this->action}";
         $navNode = $this->navService->findOneById($nodeId);
         if ($navNode != null) {
             $navNode->setActive(true);
         }
     }
     $posts = $this->wpRepo->fetchCategoryPostsBySlug($subCatSlug);
     return array('posts' => $posts, 'model' => $this->serializer->serialize(array('cat' => $this->wpRepo->fetchCategoryBySlug($catSlug), 'subCat' => $this->wpRepo->fetchCategoryBySlug($subCatSlug)), 'json'));
 }