public function loadPost(Post $post) { if ($this->isAnonymous()) { if ($authorName = $this->request->cookies->get($this->cookieName)) { $post->setAuthorName(urldecode($authorName)); } } }
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; }