/** * * @access public * @return \Symfony\Component\Form\Form */ public function getForm() { if (null == $this->form) { if (!is_object($this->topic) || !$this->topic instanceof Topic) { throw new \Exception('Topic must be specified to create a Reply in PostCreateFormHandler'); } $post = $this->postModel->createPost(); $post->setTopic($this->topic); $post->setBody($this->getQuote()); $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_REPLY_INITIALISE, new UserTopicEvent($this->request, $post->getTopic())); $this->form = $this->factory->create($this->formPostType, $post); } return $this->form; }
/** * * @access public * @return \Symfony\Component\Form\Form */ public function getForm() { if (null == $this->form) { if (!is_object($this->board) || !$this->board instanceof Board) { throw new \Exception('Board must be specified to be create a Topic in TopicCreateFormHandler'); } $filteredBoards = $this->boardModel->findAllBoardsForForumById($this->forum->getId()); $topicOptions = array('boards' => $filteredBoards, 'auto_initialize' => false); $topic = $this->topicModel->createTopic(); $topic->setBoard($this->board); $post = $this->postModel->createPost(); $post->setTopic($topic); $post->setCreatedBy($this->user); $this->dispatcher->dispatch(ForumEvents::USER_TOPIC_CREATE_INITIALISE, new UserTopicEvent($this->request, $post->getTopic())); $this->form = $this->factory->create($this->formPostType, $post); $this->form->add($this->factory->create($this->formTopicType, $topic, $topicOptions)); } return $this->form; }