/**
  *
  * @access protected
  * @param  \Map2u\ForumBundle\Entity\Post                        $post
  * @return \Map2u\ForumBundle\Form\Handler\PostUpdateFormHandler
  */
 protected function getFormHandlerToEditPost(Post $post)
 {
     // If post is the very first post of the topic then use a topic handler so user can change topic title.
     if ($post->getTopic()->getFirstPost()->getId() == $post->getId()) {
         $formHandler = $this->container->get('map2u_forum.form.handler.topic_update');
     } else {
         $formHandler = $this->container->get('map2u_forum.form.handler.post_update');
     }
     $formHandler->setPost($post);
     $formHandler->setUser($this->getUser());
     $formHandler->setRequest($this->getRequest());
     return $formHandler;
 }
Example #2
0
 /**
  *
  * @access public
  * @param  \Map2u\ForumBundle\Entity\Forum                        $forum
  * @param  \Map2u\ForumBundle\Entity\Post                         $post
  * @return \Map2u\ForumBundle\Component\Crumbs\Factory\CrumbTrail
  */
 public function addUserPostShow(Forum $forum, Post $post)
 {
     return $this->addUserTopicShow($forum, $post->getTopic())->add('# ' . $post->getId(), array('route' => 'ccdn_forum_user_post_show', 'params' => array('forumName' => $forum->getName(), 'postId' => $post->getId())));
 }