Ojs\JournalBundle\Controller\DesignController::updateAction PHP Метод

updateAction() публичный Метод

public updateAction ( Request $request, Ojs\JournalBundle\Entity\Design $design ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$design Ojs\JournalBundle\Entity\Design
Результат Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, Design $design)
    {
        $em = $this->getDoctrine()->getManager();
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'design')) {
            throw new AccessDeniedException("You are not authorized for view this journal's sections!");
        }
        $editForm = $this->createEditForm($design, $journal);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $design->setContent($this->prepareDesignContent($design->getEditableContent()));
            $em->flush();
            $this->successFlashBag('successful.update');
            return $this->redirectToRoute('ojs_journal_design_edit', ['id' => $design->getId(), 'journalId' => $journal->getId()]);
        }
        return $this->render('OjsJournalBundle:Design:edit.html.twig', array('journal' => $journal, 'entity' => $design, 'edit_form' => $editForm->createView()));
    }