public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('EDIT', $journal, 'mailTemplate')) {
throw new AccessDeniedException("You are not authorized for view this page!");
}
/** @var MailTemplate $entity */
$entity = $em->getRepository('OjsJournalBundle:MailTemplate')->find($id);
$this->throw404IfNotFound($entity);
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
$this->successFlashBag('successful.update');
return $this->redirectToRoute('ojs_journal_mail_template_edit', ['id' => $entity->getId(), 'journalId' => $journal->getId()]);
}
return $this->render('OjsJournalBundle:MailTemplate:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
}