public function createAction(Request $request, $articleId)
{
/** @var Article $article */
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$article = $this->getDoctrine()->getRepository('OjsJournalBundle:Article')->find($articleId);
$this->throw404IfNotFound($journal);
$this->throw404IfNotFound($article);
if (!$this->isGranted('CREATE', $journal, 'articles')) {
throw new AccessDeniedException("You not authorized for this page!");
}
$entity = new Citation();
$form = $this->createCreateForm($entity, $articleId);
$form->handleRequest($request);
if ($form->isValid()) {
$em = $this->getDoctrine()->getManager();
$em->persist($entity);
$em->flush();
$article->getCitations()->add($entity);
$em->persist($article);
$em->flush();
return $this->redirect($this->generateUrl('ojs_journal_citation_show', array('id' => $entity->getId(), 'journalId' => $journal->getId(), 'articleId' => $articleId)));
}
return $this->render('OjsJournalBundle:Citation:new.html.twig', array('entity' => $entity, 'form' => $form->createView()));
}