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

updateAction() public method

Edits an existing Post entity.
public updateAction ( Request $request, AdminPost $entity ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$entity Ojs\AdminBundle\Entity\AdminPost
return Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, AdminPost $entity)
    {
        $this->throw404IfNotFound($entity);
        $em = $this->getDoctrine()->getManager();
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_admin_post_edit', ['id' => $entity->getId()]);
        }
        $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_admin_post' . $entity->getId());
        return $this->render('OjsAdminBundle:AdminPost:edit.html.twig', array('token' => $token, 'entity' => $entity, 'edit_form' => $editForm->createView()));
    }