public function updateAction(Request $request, $id, $articleId)
{
$em = $this->getDoctrine()->getManager();
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
$article = $em->getRepository('OjsJournalBundle:Article')->find($articleId);
$articleAuthor = $em->getRepository('OjsJournalBundle:ArticleAuthor')->find($id);
if (!$this->isGranted('EDIT', $journal, 'articles')) {
throw new AccessDeniedException("You not authorized for this page!");
}
if (is_null($article) || is_null($articleAuthor) || $articleAuthor->getArticle()->getId() !== $article->getId()) {
$this->throw404IfNotFound($articleAuthor);
}
$editForm = $this->createEditForm($articleAuthor, $journal, $article)->add('save', 'submit', array('label' => 'save'));
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
$this->successFlashBag('successful.update');
return $this->redirect($this->generateUrl('ojs_journal_article_author_edit', array('id' => $articleAuthor->getId(), 'journalId' => $journal->getId(), 'articleId' => $article->getId())));
}
return $this->render('OjsJournalBundle:ArticleAuthor:edit.html.twig', array('entity' => $articleAuthor, 'edit_form' => $editForm->createView()));
}