Ojs\ApiBundle\Controller\Journal\JournalArticleAuthorRestController::postAuthorAction PHP Method

postAuthorAction() public method

Create a ArticleAuthor from the submitted data.
public postAuthorAction ( Request $request ) : Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
$request Symfony\Component\HttpFoundation\Request the request object
return Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
    public function postAuthorAction(Request $request)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('CREATE', $journal, 'articles')) {
            throw new AccessDeniedException();
        }
        try {
            $journalService = $this->container->get('ojs.journal_service');
            $newEntity = $this->container->get('ojs_api.journal_article_author.handler')->post($request->request->all());
            $routeOptions = array('id' => $newEntity->getId(), 'journalId' => $journalService->getSelectedJournal()->getId(), 'articleId' => $newEntity->getArticle()->getId(), '_format' => $request->get('_format'));
            return $this->routeRedirectView('api_1_article_get_author', $routeOptions, Codes::HTTP_CREATED);
        } catch (InvalidFormException $exception) {
            return $exception->getForm();
        }
    }