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

updateAction() public method

Edits an existing PersonTitle 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();
        $entity = $em->getRepository('OjsJournalBundle:PersonTitle')->find($id);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find PersonTitle entity.');
        }
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirect($this->generateUrl('ojs_admin_person_title_edit', array('id' => $id)));
        }
        $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_admin_person_title' . $entity->getId());
        return $this->render('OjsAdminBundle:AdminPersonTitle:edit.html.twig', array('entity' => $entity, 'token' => $token, 'edit_form' => $editForm->createView()));
    }