Example #1
0
 protected function addCateg($manager, $name, $description)
 {
     $categ = new Category();
     $categ->setName($name);
     $categ->setDescription($description);
     $topic = new Topic();
     $topic->setSubject('New forum category: ' . $name);
     $topic->setCategory($categ);
     $this->container->get('herzult_forum.creator.topic')->create($topic);
     $post = new Post();
     $post->setMessage($description);
     $post->setAuthorName('lichess.org staff');
     $post->setTopic($topic);
     $this->container->get('herzult_forum.creator.post')->create($post);
     $manager->persist($categ);
     $manager->persist($topic);
     $manager->persist($post);
     return $topic;
 }
Example #2
0
 protected function getTopicData(Topic $topic)
 {
     return array('comment_type' => 'comment', 'comment_author' => $topic->getFirstPost()->getAuthorName(), 'comment_content' => $topic->getSubject() . ' ' . $topic->getFirstPost()->getMessage());
 }
 public function persistTopic(Topic $topic, Response $response)
 {
     if ($this->isAnonymous()) {
         $response->headers->setCookie(new Cookie($this->cookieName, urlencode($topic->getLastPost()->getAuthorName()), time() + 15552000));
     }
 }