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

updateAction() public method

Edits an existing Institution entity.
public updateAction ( Request $request, $id ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$id
return Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        /** @var Institution $entity */
        $entity = $em->getRepository('OjsJournalBundle:Institution')->find($id);
        $this->throw404IfNotFound($entity);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->persist($entity);
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_admin_institution_edit', ['id' => $id]);
        }
        return $this->render('OjsAdminBundle:AdminInstitution:edit.html.twig', array('entity' => $entity, 'form' => $editForm->createView()));
    }