public postFileAction ( |
||
$request | the request object | |
return | Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View |
public function postFileAction(Request $request)
{
$journal = $this->get('ojs.journal_service')->getSelectedJournal();
if (!$this->isGranted('CREATE', $journal, 'issues')) {
throw new AccessDeniedException();
}
try {
$journalService = $this->container->get('ojs.journal_service');
$newEntity = $this->container->get('ojs_api.journal_issue_file.handler')->post($request->request->all());
$routeOptions = array('id' => $newEntity->getId(), 'journalId' => $journalService->getSelectedJournal()->getId(), 'issueId' => $newEntity->getIssue()->getId(), '_format' => $request->get('_format'));
return $this->routeRedirectView('api_1_issue_get_file', $routeOptions, Codes::HTTP_CREATED);
} catch (InvalidFormException $exception) {
return $exception->getForm();
}
}