public function deleteAction(Request $request, $id)
{
$translator = $this->get('translator');
$cacheService = $this->get('newscoop.cache');
$node = $this->findOr404($id);
if (is_array($node)) {
return new JsonResponse($node, 404);
}
$topicService = $this->get('newscoop_newscoop.topic_service');
$topicService->deleteTopic($node);
$cacheService->clearNamespace('topic');
$this->get('dispatcher')->dispatch('topic.delete', new GenericEvent($this, array('title' => $node->getTitle(), 'id' => array('id' => $id), 'diff' => array('id' => $id, 'title' => $node->getTitle()))));
return new JsonResponse(array('status' => true, 'message' => $translator->trans('topics.removed', array('%title%' => $node->getTitle()), 'topics')));
}