Ojs\JournalBundle\Controller\ArticleAuthorController::editAction PHP 메소드

editAction() 공개 메소드

Displays a form to edit an existing ArticleAuthor entity.
public editAction ( $id, $articleId ) : Response
$id
$articleId
리턴 Symfony\Component\HttpFoundation\Response
    public function editAction($id, $articleId)
    {
        $em = $this->getDoctrine()->getManager();
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        $article = $em->getRepository('OjsJournalBundle:Article')->find($articleId);
        $articleAuthor = $em->getRepository('OjsJournalBundle:ArticleAuthor')->find($id);
        if (is_null($article) || is_null($articleAuthor) || $articleAuthor->getArticle()->getId() !== $article->getId()) {
            $this->throw404IfNotFound($articleAuthor);
        }
        if (!$this->isGranted('EDIT', $journal, 'articles')) {
            throw new AccessDeniedException("You not authorized for this page!");
        }
        $editForm = $this->createEditForm($articleAuthor, $journal, $article)->add('save', 'submit', array('label' => 'save'));
        $token = $this->get('security.csrf.token_manager')->refreshToken('ojs_journal_article_author' . $articleAuthor->getId());
        return $this->render('OjsJournalBundle:ArticleAuthor:edit.html.twig', array('entity' => $articleAuthor, 'edit_form' => $editForm->createView(), 'token' => $token));
    }