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

updateAction() public method

Edits an existing PublisherThemes entity.
public updateAction ( Request $request, integer $publisherId, PublisherTheme $entity ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$publisherId integer
$entity Ojs\JournalBundle\Entity\PublisherTheme
return Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, $publisherId, PublisherTheme $entity)
    {
        $em = $this->getDoctrine()->getManager();
        $publisher = $em->getRepository('OjsJournalBundle:Publisher')->find($publisherId);
        $this->throw404IfNotFound($publisher);
        if (!$this->isGrantedForPublisher($publisher)) {
            throw new AccessDeniedException("You are not authorized for this page!");
        }
        $editForm = $this->createEditForm($entity, $publisher);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $entity->setPublisher($publisher);
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_publisher_manager_theme_edit', ['publisherId' => $publisherId, 'id' => $entity->getId()]);
        }
        return $this->render('OjsJournalBundle:ManagerPublisherTheme:edit.html.twig', array('entity' => $entity, 'publisher' => $publisher, 'edit_form' => $editForm->createView()));
    }