@param Request $request

@return Response
507396
public function changeFieldTypeAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw $this->createAccessDeniedException();
        }

        $type = $request->get('type');
        $fieldType = $this->fieldManager->getFieldTypeByCode($type);

        $formName = $request->get('formPath');

        $formPath = $this->getFormPath($formName);
        // Extract first item to create named builder
        $rootPath = array_shift($formPath);
        $formChildren = $formPath;
        $rootFormBuilder = $this->formFactory->createNamedBuilder($rootPath, FormType::class, null, ['translation_domain' => 'AdvancedContentBundle']);
        // Create formBuilder recursively, according to formName
        $formBuilder = $this->createEmbeddedForm($formPath, $rootFormBuilder);
        $formBuilder->add('options', FormType::class);

        $fieldType->addFieldOptions($formBuilder);

        $form = $rootFormBuilder->getForm();
        foreach ($formChildren as $child) {
            $form = $form->get($child);
        }
        $formView = $form->createView();

        $response = [
            'success' => 1,
            'optionHtml'    => $this->renderView('@SherlockodeAdvancedContent/ContentType/field_options_render.html.twig', [
                'options' => $formView['options'],
            ]),
            'layoutHtml'    => $this->renderView('@SherlockodeAdvancedContent/ContentType/field_layout.html.twig', [
                'form' => $formView,
            ])
        ];

        return new JsonResponse($response);
    }
1123829
public function resultAction(Request $request)
    {
        try {
            $this
                ->gestpayManager
                ->processResult($request->query->all());
        } catch (PaymentException $e) {
            $this
                ->logger
                ->log(
                    'error',
                    'Gestpay error "'.$e->getMessage(),
                    GestpayMethod::METHOD_NAME
                );
        }

        return new Response('OK');
    }
1221396
public function send(Request $request)
    {
        $response   = new DeleteResponse();
        $rpbPutReq  = $this->createRpbMessage($request);

        $this->client->send($rpbPutReq, RiakMessageCodes::DEL_REQ, RiakMessageCodes::DEL_RESP);

        return $response;
    }
71422
public function detect(Request $request)
	{
		if ($request->isMethod('post')) {
			return $request->request->get($this->parameterName);
		}

		return $request->query->get($this->parameterName);
	}
1005204
public function index(Request $request)
    {
        $this->validate($request, ['thread_id' => ['required']]);

        $posts = $this->model()->where('thread_id', $request->input('thread_id'))->get();

        return $this->response($posts);
    }
1003931
public function send(Request $request)
    {
        foreach ($this->cookies as $cookie) {
            $request->addCookie($cookie);
        }

        $response = $this->client->request($request);

        if ($response->getCookies()) {
            $this->cookies = $response->getCookies();
        }

        return $response;
    }
1044107
public function send(Request $request)
    {
        $response     = new GetIndexResponse();
        $httpRequest  = $this->createHttpRequest($request);
        $httpResponse = $this->client->send($httpRequest);
        $json         = $httpResponse->json();

        $response->name   = $request->name;
        $response->nVal   = $json['n_val'];
        $response->schema = $json['schema'];

        return $response;
    }
365821
public function send(Request $request)
    {
        $response   = new GetResponse();
        $rpbGetReq  = $this->createRpbMessage($request);
        $rpbGetResp = $this->client->send($rpbGetReq, RiakMessageCodes::GET_REQ, RiakMessageCodes::GET_RESP);

        if ( ! $rpbGetResp instanceof RpbGetResp) {
            return $response;
        }

        if ( ! $rpbGetResp->hasContent()) {
            return $response;
        }

        $response->vClock      = $rpbGetResp->getVclock()->get();
        $response->contentList = $this->createContentList($rpbGetResp->getContentList());

        return $response;
    }
66680
public function postRequestAsync( Request $request ) {
		$promise = $this->getClient()->requestAsync(
			'POST',
			$this->apiUrl,
			$this->getClientRequestOptions( $request, $this->getPostRequestEncoding( $request ) )
		);

		return $promise->then( function ( ResponseInterface $response ) {
			return call_user_func( [ $this, 'decodeResponse' ], $response );
		} );
	}
464439
public function send(Request $request)
    {
        $response     = new PutSchemaResponse();
        $httpRequest  = $this->createHttpRequest($request);

        $this->client->send($httpRequest);

        return $response;
    }
309450
public function store(Request $request)
    {
        $response = $this->repository->create($request->all());
        return Response::apiResponse([
            'data' => $response
        ]);
    }
441104
public function post(Request $request)
    {
        $userData = $this->getContentAsArray($request);

        $errors = $this->userRegistrationValidator->validate($userData ?: []);

        if (count($errors) > 0) {
            return $this->createConstraintViolationResponse($errors);
        }

        try {
            $newUser = $this->userService->register($userData);
        } catch (OutOfBoundsException $e) {
            return $this->createEmailNotUniqueResponse();
        }

        $newUser = $this->userArrayWithoutPassword($newUser);

        $newUser['_href'] = $this->url('user-entity', array('user' => $newUser['id']));

        return $this->createJsonResponse($newUser, 201);
    }
721541
public function createAction(Request $request)
    {
        $form = $this->buildForm();

        if ($request->isMethod('POST') && $this->submitForm($form, $request)->isValid()) {
            try {
                $this->getDomainManager()->create($form->getData());
            } catch (DomainException $e) {
                $this->processException($e);
            }
        }

        return $this->processAction('create', $form, Response::HTTP_CREATED);
    }
907356
public function requestAction(Request $request)
    {
        $widget = $request->isXmlHttpRequest();

        $form = $this->getPasswordResetTokenFormFactory()->createRequestForm()->handleRequest($request);

        if (!$form->isSubmitted()) {
            return new Response($this->getPasswordResetTokenFormRenderer()->renderRequestForm($widget, $form));
        }

        $successMessage = 'password_reset_token.action.request.success';

        $passwordResetToken = $this->getPasswordResetTokenFormHandler()->handleRequestForm($form, !$widget, $successMessage);

        if (empty($passwordResetToken)) {
            $html = $this->getPasswordResetTokenFormRenderer()->renderRequestForm($widget, $form);

            return $widget
                ? new AjaxResponse($html, false, FlashNotifierInterface::MESSAGE_FORM_ERROR)
                : new Response($html);
        }
        if ($widget) {
            $webmailLink   = null;
            $webmailLinker = $this->getWebmailLinker();

            if (!empty($webmailLinker)) {
                $webmailLink = $webmailLinker->getProviderByEmailAddress($passwordResetToken->getUser()->getEmail());
            }

            return new AjaxResponse(
                $this->renderView('DarvinUserBundle:PasswordResetToken/widget/request:submitted.html.twig', [
                    'password_reset_token' => $passwordResetToken,
                    'webmail_link'         => $webmailLink,
                ]),
                true,
                $successMessage
            );
        }

        return $this->redirectToRoute('darvin_user_security_login');
    }
1245190
public function viewAction(Request $request): Response
    {
        $configuration = $this->requestConfigurationFactory->create($this->metadata, $request);

        $this->isGrantedOr403($configuration, ResourceActions::SHOW);

        /** @var DefinedTranslationInterface|TemplateAwareInterface|ResourceInterface $resource */
        $resource = $this->findOr404($configuration);

        $this->eventDispatcher->dispatch(ResourceActions::SHOW, $configuration, $resource);

        $view = View::create($resource);

        if ($configuration->isHtmlRequest()) {
            $template = $resource->getTemplate();

            if ($template) {
                $tpl = $resource->getTemplateName();
                $options = $template->getOptions();
            } else {
                $tpl = $configuration->getTemplate(ResourceActions::SHOW.'.html');
                $options = [];
            }

            $this->addTranslations($resource);

            $view
                ->setTemplate($tpl)
                ->setTemplateVar($this->metadata->getName())
                ->setData(
                    [
                        'configuration' => $configuration,
                        'metadata' => $this->metadata,
                        'resource' => $resource,
                        'tpl' => ['options' => $options],
                        $this->metadata->getName() => $resource,
                    ]
                );
        }

        return $this->viewHandler->handle($configuration, $view);
    }
875365
public function handle(Request $request)
    {
        try {
            $restRequest = new RestRequest($this->config, $request->getMethod(), $request->getUri(), $request->getContent());
            $restResponse = $this->adapter->processRequest($restRequest);
        } catch (\Exception $e) {
            if (true === $this->debugEnabled()) {
                throw $e;
            }
            $restResponse = $this->adapter->handleException($e);
        }
        return new Response($restResponse->getContent(), $restResponse->getStatus(), $restResponse->getHeaders());
    }
1203633
public function httpGet(Request $request) : Response
    {
        // Use Raw doc by default if not provided
        $filename = $request->get('filename') ?? RawDocProvider::SUPPORTED_FILENAME;
        $response = new Response();
        $response->headers->set('Content-Type', 'application/json');

        $doc = $this->normalizedDocFinder->findFor($filename, $request->getHttpHost());

        $response->setContent(json_encode($doc));

        return $response;
    }