Ojs\JournalBundle\Controller\ArticleFileController::editAction PHP Method

editAction() public method

Displays a form to edit an existing ArticleFile entity.
public editAction ( integer $id, integer $articleId ) : Response
$id integer
$articleId integer
return Symfony\Component\HttpFoundation\Response
    public function editAction($id, $articleId)
    {
        $journalService = $this->get('ojs.journal_service');
        $journal = $journalService->getSelectedJournal();
        $em = $this->getDoctrine()->getManager();
        if (!$this->isGranted('EDIT', $journal, 'articles')) {
            throw new AccessDeniedException("You not authorized for this page!");
        }
        /** @var Article $article */
        $article = $em->getRepository('OjsJournalBundle:Article')->find($articleId);
        $this->throw404IfNotFound($article);
        /** @var ArticleFile $entity */
        $entity = $em->getRepository('OjsJournalBundle:ArticleFile')->findOneBy(['article' => $article, 'id' => $id]);
        $this->throw404IfNotFound($entity);
        $editForm = $this->createEditForm($entity, $journal, $article)->add('save', 'submit', ['label' => 'save']);
        $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_journal_article_file' . $entity->getId());
        return $this->render('OjsJournalBundle:ArticleFile:edit.html.twig', ['entity' => $entity, 'edit_form' => $editForm->createView(), 'token' => $token]);
    }