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

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

Edits an existing Citation entity.
public updateAction ( Request $request, $id, integer $articleId ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$id
$articleId integer
Результат Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, $id, $articleId)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $this->throw404IfNotFound($journal);
        if (!$this->isGranted('EDIT', $journal, 'articles')) {
            throw new AccessDeniedException("You not authorized for this page!");
        }
        $em = $this->getDoctrine()->getManager();
        $entity = $em->getRepository('OjsJournalBundle:Citation')->find($id);
        if (!$entity) {
            throw $this->createNotFoundException('Unable to find Citation entity.');
        }
        $editForm = $this->createEditForm($entity, $articleId);
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            return $this->redirect($this->generateUrl('ojs_journal_citation_edit', array('id' => $id, 'journalId' => $journal->getId(), 'articleId' => $articleId)));
        }
        return $this->render('OjsJournalBundle:Citation:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
    }