public postIndexesAction ( |
||
$request | the request object | |
return | Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View |
public function postIndexesAction(Request $request)
{
if (!$this->isGranted('CREATE', new Index())) {
throw new AccessDeniedException();
}
try {
$newEntity = $this->container->get('ojs_api.index.handler')->post($request->request->all());
$routeOptions = array('id' => $newEntity->getId(), '_format' => $request->get('_format'));
return $this->routeRedirectView('api_1_get_indexs', $routeOptions, Codes::HTTP_CREATED);
} catch (InvalidFormException $exception) {
return $exception->getForm();
}
}