Ojs\ApiBundle\Controller\Journal\JournalThemeRestController::postThemeAction PHP Method

postThemeAction() public method

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