Inheritance: extends Phoenix\View\ItemView
Example #1
0
 /**
  * doExecute
  *
  * @return  mixed
  */
 protected function doExecute()
 {
     $this->app->set('list.limit', 15);
     $id = $this->id = $this->input->get('id');
     $this->prepareUserState($this->model);
     $topicModel = $this->getModel('Topic');
     $postsModel = $this->model;
     // Topic
     $topic = $topicModel->getItem($id);
     if ($topic->isNull()) {
         throw new \UnexpectedValueException('Topic not found', 404);
     }
     $postsModel['list.ordering'] = 'post.ordering';
     $postsModel['list.direction'] = 'ASC';
     $postsModel['list.filter'] = array('post.topic_id' => $topic->id);
     $posts = $postsModel->getItems();
     $pagination = $postsModel->getPagination();
     $this->view['topic'] = $topic;
     $this->view['posts'] = $posts;
     $this->view['pagination'] = $pagination;
     // Add hits
     $topicModel->addHit($topic->id, 1);
     return $this->view->render();
 }