Newscoop\NewscoopBundle\Services\TopicService::deleteTopic PHP Method

deleteTopic() public method

Deletes the topic. If topic is attached to any article it is first detached and deleted.
public deleteTopic ( Topic $topic ) : boolean
$topic Newscoop\NewscoopBundle\Entity\Topic Topic
return boolean
    public function deleteTopic(Topic $topic)
    {
        if ($this->isAttached($topic->getId())) {
            $this->removeTopicFromAllArticles($topic->getId());
        }
        $this->removeTopicFromAllUsers($topic->getId());
        $this->em->remove($topic);
        $this->em->flush();
        $this->em->clear();
        return true;
    }