public removeArticleAction ( |
||
$request | ||
$id | integer | |
$articleId | integer | |
return |
public function removeArticleAction(Request $request, $id, $articleId)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('EDIT', $journal, 'issues')) {
throw new AccessDeniedException("You are not authorized for edit this journal's issue!");
}
$referrer = $request->headers->get('referer');
$em = $this->getDoctrine()->getManager();
$issue = $em->getRepository('OjsJournalBundle:Issue')->find($id);
$this->throw404IfNotFound($issue);
/** @var Article $article */
$article = $em->getRepository('OjsJournalBundle:Article')->find($articleId);
$this->throw404IfNotFound($article);
$article->setIssue(null);
$em->persist($article);
$em->flush();
$this->successFlashBag('successful.remove');
return $this->redirect($referrer);
}