/** * */ public function remove(TopicInterface $topic, $andFlush = true) { $category = $topic->getCategory(); $this->logger->debug(sprintf('Removing all posts associated with topic: %s.', $topic->getId())); $posts = $this->TopicManager->findAllByTopic($topic); $this->TopicManager->removeAll($posts); $this->logger->debug(sprintf('Removing topic: %s.', $topic->getId())); $this->objectManager->remove($topic); if ($andFlush) { $this->objectManager->flush(); //$this->categoryUpdater->update($category); } }