Example #1
0
 /**
  * @return \Doctrine\Common\Collections\Collection
  */
 public function getPosts()
 {
     if (null === $this->posts) {
         $this->posts = $this->postService->getPosts($this->page, $this->options->getPostsPerPage());
     }
     return $this->posts;
 }
Example #2
0
 /**
  * @param bool $excerpt
  *
  * @return string
  */
 public function render($excerpt = false)
 {
     $postViewModel = new ViewModel();
     $postViewModel->setTemplate($this->options->getPostTemplate());
     $postViewModel->setVariables(array('useExcerpt' => $excerpt, 'post' => $this->getPost(), 'attributes' => $this->renderAttributes($this->options->getPostAttributes())));
     if ($excerpt) {
         $postViewModel->setVariable('excerpt', $this->postService->getExcerpt($this->getPost(), $this->options->getExcerptLength()));
     }
     return $this->getView()->render($postViewModel);
 }
Example #3
0
 /**
  * @return \Zend\Http\Response
  */
 public function deleteAction()
 {
     $slug = $this->params('slug');
     $this->postService->delete($slug);
     $this->flashMessenger()->setNamespace('sxblog_post')->addMessage($this->getMessage('post_deletion_success'));
     return $this->redirect()->toRoute($this->options->getRouteAfterPostDelete());
 }