public function postContacttypeAction(Request $request)
{
if (!$this->isGranted('CREATE', new ContactTypes())) {
throw new AccessDeniedException();
}
try {
$newContactType = $this->container->get('ojs_api.contact_type.handler')->post($request->request->all());
$routeOptions = array('id' => $newContactType->getId(), '_format' => $request->get('_format'));
return $this->routeRedirectView('api_1_get_contacttypes', $routeOptions, Codes::HTTP_CREATED);
} catch (InvalidFormException $exception) {
return $exception->getForm();
}
}