Newscoop\NewscoopBundle\Services\TopicService::deleteTopic PHP Méthode

deleteTopic() public méthode

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
Résultat 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;
    }