/** * * @access public * @param \CCDNForum\ForumBundle\Entity\Topic $topic * @param \Symfony\Component\Security\Core\User\UserInterface $user * @return \CCDNForum\ForumBundle\Manager\ManagerInterface */ public function close(Topic $topic, UserInterface $user) { // Don't overwite previous users accountability. if (!$topic->getClosedBy() && !$topic->getClosedDate()) { $topic->setClosed(true); $topic->setClosedBy($user); $topic->setClosedDate(new \DateTime()); $this->persist($topic)->flush(); } return $this; }