Ojs\ApiBundle\Controller\Admin\LangRestController::postLangAction PHP Метод

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

Create a Lang from the submitted data.
public postLangAction ( Request $request ) : Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
$request Symfony\Component\HttpFoundation\Request the request object
Результат Symfony\Component\Form\FormTypeInterface | FOS\RestBundle\Controller\Annotations\View
    public function postLangAction(Request $request)
    {
        if (!$this->isGranted('CREATE', new Lang())) {
            throw new AccessDeniedException();
        }
        try {
            $newEntity = $this->container->get('ojs_api.lang.handler')->post($request->request->all());
            $routeOptions = array('id' => $newEntity->getId(), '_format' => $request->get('_format'));
            return $this->routeRedirectView('api_1_get_langs', $routeOptions, Codes::HTTP_CREATED);
        } catch (InvalidFormException $exception) {
            return $exception->getForm();
        }
    }