Ojs\ApiBundle\Controller\Journal\JournalArticleCitationRestController::postCitationAction PHP Method

postCitationAction() public method

Create a ArticleCitation from the submitted data.
public postCitationAction ( 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 postCitationAction(Request $request)
    {
        $journal = $this->get('ojs.journal_service')->getSelectedJournal();
        if (!$this->isGranted('CREATE', $journal, 'articles')) {
            throw new AccessDeniedException();
        }
        try {
            $articleCitationHandler = $this->container->get('ojs_api.journal_article_citation.handler');
            $journalService = $this->container->get('ojs.journal_service');
            $newEntity = $articleCitationHandler->post($request->request->all());
            $routeOptions = array('id' => $newEntity->getId(), 'journalId' => $journalService->getSelectedJournal()->getId(), 'articleId' => $articleCitationHandler->getArticle()->getId(), '_format' => $request->get('_format'));
            return $this->routeRedirectView('api_1_article_get_citation', $routeOptions, Codes::HTTP_CREATED);
        } catch (InvalidFormException $exception) {
            return $exception->getForm();
        }
    }