Ojs\ApiBundle\Controller\Journal\JournalArticleAuthorRestController::patchAuthorAction PHP Метод

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

Update existing article author from the submitted data or create a new article author at a specific location.
public patchAuthorAction ( Request $request, integer $id ) : Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
$request Symfony\Component\HttpFoundation\Request the request object
$id integer the article author id
Результат Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
    public function patchAuthorAction(Request $request, $id)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('EDIT', $journal, 'articles')) {
            throw new AccessDeniedException();
        }
        try {
            $journalService = $this->container->get('ojs.journal_service');
            $entity = $this->container->get('ojs_api.journal_article_author.handler')->patch($this->getOr404($id), $request->request->all());
            $routeOptions = array('id' => $entity->getId(), 'journalId' => $journalService->getSelectedJournal()->getId(), 'articleId' => $entity->getArticle()->getId(), '_format' => $request->get('_format'));
            return $this->routeRedirectView('api_1_article_get_author', $routeOptions, Codes::HTTP_NO_CONTENT);
        } catch (InvalidFormException $exception) {
            return $exception->getForm();
        }
    }