Ojs\ApiBundle\Controller\Admin\ContactTypesRestController::postContacttypeAction PHP Метод

postContacttypeAction() публичный Метод

Create a Contact Type from the submitted data.
public postContacttypeAction ( Request $request ) : Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\View\View
$request Symfony\Component\HttpFoundation\Request the request object
Результат Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\View\View
    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();
        }
    }