Ojs\AdminBundle\Controller\AdminContactController::updateAction PHP Method

updateAction() public method

Edits an existing JournalContact entity.
public updateAction ( Request $request, integer $id ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$id integer
return Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    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()));
    }