public function updateAction(Request $request, $id)
{
$em = $this->getDoctrine()->getManager();
/** @var JournalContact $entity */
$entity = $em->getRepository('OjsJournalBundle:JournalContact')->findOneBy(['id' => $id]);
$this->throw404IfNotFound($entity);
/** @var $dispatcher EventDispatcherInterface */
$dispatcher = $this->get('event_dispatcher');
$editForm = $this->createEditForm($entity);
$editForm->handleRequest($request);
if ($editForm->isValid()) {
$em->flush();
$this->successFlashBag('successful.update');
$event = new AdminEvent(['eventType' => 'update', 'entity' => $entity]);
$dispatcher->dispatch(AdminEvents::ADMIN_CONTACT_CHANGE, $event);
return $this->redirectToRoute('ojs_admin_contact_edit', ['id' => $entity->getId()]);
}
return $this->render('OjsAdminBundle:AdminContact:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
}