Ojs\JournalBundle\Controller\JournalThemeController::updateAction PHP Method

updateAction() public method

Edits an existing Theme 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();
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'theme')) {
            throw new AccessDeniedException("You are not authorized for view this page");
        }
        /** @var JournalTheme $entity */
        $entity = $em->getRepository('OjsJournalBundle:JournalTheme')->find($id);
        $this->throw404IfNotFound($entity);
        $editForm = $this->createEditForm($entity);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_journal_theme_edit', ['id' => $entity->getId(), 'journalId' => $journal->getId()]);
        }
        return $this->render('OjsJournalBundle:Theme:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
    }