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

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

Edits an existing IssueFile entity.
public updateAction ( Request $request, $id ) : RedirectResponse | Response
$request Symfony\Component\HttpFoundation\Request
$id
Результат Symfony\Component\HttpFoundation\RedirectResponse | Symfony\Component\HttpFoundation\Response
    public function updateAction(Request $request, $id)
    {
        $em = $this->getDoctrine()->getManager();
        /** @var IssueFile $entity */
        $entity = $em->getRepository('OjsJournalBundle:IssueFile')->find($id);
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'issues')) {
            throw new AccessDeniedException('You are not authorized for edit this issue file!');
        }
        /** @var Issue $issue */
        $issue = $em->getRepository('OjsJournalBundle:Issue')->find($entity->getIssue()->getId());
        $this->throw404IfNotFound($issue);
        $this->throw404IfNotFound($entity);
        $editForm = $this->createEditForm($entity)->add('edit', 'submit', array('label' => 'e'));
        $editForm->handleRequest($request);
        if ($editForm->isValid()) {
            $em->flush();
            return $this->redirect($this->generateUrl('ojs_journal_issue_file_edit', array('id' => $id, 'journalId' => $journal->getId(), 'issueId' => $entity->getIssue()->getId())));
        }
        return $this->render('OjsJournalBundle:IssueFile:edit.html.twig', array('entity' => $entity, 'edit_form' => $editForm->createView()));
    }