public function deleteAction(Request $request, $id, $articleId)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$this->throw404IfNotFound($journal);
// Because when we delete a citation, that means we are editing an article.
if (!$this->isGranted('EDIT', $journal, 'articles')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$em = $this->getDoctrine()->getManager();
$entity = $em->getRepository('OjsJournalBundle:Citation')->find($id);
$this->throw404IfNotFound($entity);
$csrf = $this->get('security.csrf.token_manager');
$token = $csrf->getToken('ojs_journal_citation' . $id);
if ($token != $request->get('_token')) {
throw new TokenNotFoundException("Token Not Found!");
}
$this->get('ojs_core.delete.service')->check($entity);
$em->remove($entity);
$em->flush();
$this->successFlashBag('successful.remove');
return $this->redirect($this->generateUrl('ojs_journal_citation_index', array('journalId' => $journal->getId(), 'articleId' => $articleId)));
}