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

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

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