@param \Symfony\Component\HttpFoundation\Request $request

@return \Symfony\Component\HttpFoundation\Response

@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
964841
public function trashAction(Request $request): Response
    {
        $form = $this->formFactory->trashLocationWithAsset(
            new LocationTrashWithAssetData()
        );
        $form->handleRequest($request);

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationTrashWithAssetData $data) {
                $location = $data->getLocation();
                $parentLocation = $this->locationService->loadLocation($location->parentLocationId);
                if ($data->getTrashAssets() === LocationTrashWithAssetType::RADIO_SELECT_TRASH_WITH_ASSETS) {
                    $content = $this->contentService->loadContentByContentInfo($location->contentInfo);
                    $relations = $this->contentService->loadRelations($content->versionInfo);
                    $imageLocation = $this->locationService->loadLocation($relations[0]->destinationContentInfo->mainLocationId);
                    $this->trashService->trash($imageLocation);
                }

                $this->trashService->trash($location);

                return $this->redirectToLocation($parentLocation);
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('ezplatform.trash.list'));
    }
879104
public function requestApiKeyAction(Request $request)
    {
        /** @var \Symfony\Component\EventDispatcher\EventDispatcherInterface $dispatcher */
        $dispatcher = $this->get('event_dispatcher');

        $credentials = [];
        if ($request->request->has('login')) {
            $credentials[$this->getPropertyName(ClassMetadata::LOGIN_PROPERTY)] = $request->request->get('login');
        }
        if ($request->request->has('password')) {
            $credentials[$this->getPropertyName(ClassMetadata::PASSWORD_PROPERTY)] = $request->request->get('password');
        }
        [$user, $exception] = $this->processAuthentication($credentials);

        /** @var OnAssembleResponseEvent $result */
        $result = $dispatcher->dispatch(
            Ma27ApiKeyAuthenticationEvents::ASSEMBLE_RESPONSE,
            new OnAssembleResponseEvent($user, $exception)
        );

        if (!$response = $result->getResponse()) {
            throw new HttpException(
                Response::HTTP_INTERNAL_SERVER_ERROR,
                'Cannot assemble the response!',
                $exception
            );
        }

        return $response;
    }
431283
public function listMediaAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $folder = $this->findFolderById($request->attributes->get('id'));

        $medias = $this
            ->get('ekyna_media.browser')
            ->setFolder($folder)
            ->findMedias((array)$request->query->get('types'));

        $data = array('medias' => $medias);

        $response = new Response($this->get('jms_serializer')->serialize(
            $data,
            'json',
            SerializationContext::create()->setGroups(array('Manager'))
        ));

        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
745185
public function postAction(Request $request)
    {
        try {
            $attribute = $this->getManager()->save(
                $request->request->all(),
                $this->getLocale($request),
                $this->getUser()->getId()
            );
            $view = $this->view($attribute, 200);
        } catch (AttributeDependencyNotFoundException $exc) {
            $exception = new EntityNotFoundException($exc->getEntityName(), $exc->getId());
            $view = $this->view($exception->toArray(), 400);
        } catch (MissingAttributeException $exc) {
            $exception = new MissingArgumentException(self::$entityName, $exc->getAttribute());
            $view = $this->view($exception->toArray(), 400);
        }

        return $this->handleView($view);
    }
693923
public function inlineEditAction(Request $request)
    {
        $id = $request->get('pk');
        $name = $request->get('value');

        /** @var $tag Tag */
        if (!$tag = $this->admin->getObject($id)) {
            throw new NotFoundHttpException('unable to find the tag with the id');
        }

        $tag->setName($name);

        $validator = $this->get('validator');
        $errors = $validator->validate($tag);

        if (count($errors) > 0) {
            $messages = [];
            foreach ($errors as $error) {
                $messages[] = $error->getMessage();
            }

            return new Response(implode(', ', $messages), 400);
        }

        $this->admin->update($tag);

        return $this->renderJson([
            'result' => 'ok',
            'objectId' => $id,
        ]);
    }
112075
public function putAction(Request $request, $id)
    {
        /** @var Group $group */
        $group = $this->getDoctrine()
            ->getRepository(static::$entityName)
            ->findGroupById($id);

        try {
            if (!$group) {
                throw new EntityNotFoundException(static::$entityName, $id);
            } else {
                $em = $this->getDoctrine()->getManager();

                $name = $request->get('name');

                $group->setName($name);

                $this->setParent($group, $request);

                if (!$this->processRoles($group, $request->get('roles', []))) {
                    throw new RestException('Could not update dependencies!');
                }

                $em->flush();
                $view = $this->view($group, 200);
            }
        } catch (EntityNotFoundException $enfe) {
            $view = $this->view($enfe->toArray(), 404);
        } catch (RestException $re) {
            $view = $this->view($re->toArray(), 400);
        }

        return $this->handleView($view);
    }
989543
protected function runController(Request $request)
	{
		list($class, $method) = explode('@', $this->action['uses']);

		$parameters = $this->resolveClassMethodDependencies(
			$this->parametersWithoutNulls(), $class, $method
		);

		if ( ! method_exists($instance = $this->container->make($class), $method))
		{
			throw new NotFoundHttpException;
		}

		return call_user_func_array([$instance, $method], $parameters);
	}
347723
public function allAction(Request $request)
    {
        $model = $this->getModel();

        $content = $this->restUtils->serialize($model->findAll($request));

        $response = $this->getResponse()
            ->setStatusCode(Response::HTTP_OK)
            ->setContent($content);

        return $response;
    }
697799
private function route(Request $request) : RouteMatch
    {
        foreach ($this->routes as $route) {
            try {
                $match = $route->match($request);
            }
            catch (RoutingException $e) {
                throw new HttpNotFoundException($e->getMessage(), $e);
            }

            if ($match !== null) {
                if ($match instanceof RouteMatch) {
                    return $match;
                }

                throw $this->invalidReturnValue('route', Route::class . ' or NULL', $match);
            }
        }

        throw new HttpNotFoundException('No route matches the request.');
    }
11158
protected function send(Request $request)
    {
        try {
            $response = $this->client->send($request);
        } catch (ClientException $e) {
            $response = $e->getResponse();
        } catch (ServerException $e) {
            $response = $e->getResponse();
        }

        return $response;
    }
266752
public function route(Request $request) : Response
    {
        $method = $request->getMethod();

        /** @var ParsedRoute $route */
        foreach ($this->routeCollection->get($method) as $route) {
            $compiledRoute = $this->compiler->compile($route, $request);

            if ($compiledRoute->isMatch()) {
                $this->matchedRoute = $compiledRoute;

                return $this->dispatcher->dispatch($this->matchedRoute, $request, $this->matchedController);
            }
        }

        // If we've gotten here, we've got a missing route
        throw new HttpException(404);
    }
144952
public function updateAction(Request $request): Response
    {
        $form = $this->formFactory->updateLocation();
        $form->handleRequest($request);

        $location = $form->getData()->getLocation();

        if ($form->isSubmitted()) {
            $result = $this->submitHandler->handle($form, function (LocationUpdateData $data) {
                $location = $data->getLocation();

                $locationUpdateStruct = new LocationUpdateStruct(['sortField' => $data->getSortField(), 'sortOrder' => $data->getSortOrder()]);
                $this->locationService->updateLocation($location, $locationUpdateStruct);

                $this->notificationHandler->success(
                    $this->translator->trans(
                        /** @Desc("Location '%name%' updated.") */
                        'location.update.success',
                        ['%name%' => $location->getContentInfo()->name],
                        'location'
                    )
                );

                return new RedirectResponse($this->generateUrl('_ezpublishLocation', [
                        'locationId' => $location->getContentInfo()->mainLocationId,
                        '_fragment' => DetailsTab::URI_FRAGMENT,
                    ]));
            });

            if ($result instanceof Response) {
                return $result;
            }
        }

        return $this->redirect($this->generateUrl('_ezpublishLocation', [
            'locationId' => $location->getContentInfo()->mainLocationId,
            '_fragment' => DetailsTab::URI_FRAGMENT,
        ]));
    }
1028569
public function createFromRequest(Request $request)
    {
        $notFound = new $this->class(
            $request->getPathInfo(),
            $request->getUri(),
            $request->server->get('HTTP_REFERER')
        );

        $this->om->persist($notFound);
        $this->om->flush();

        return $notFound;
    }
1289893
public function index(Request $request)
    {
        if ($request->get('hub_mode') === 'subscribe'
            && $request->get('hub_verify_token') === $this->config->get('fb-messenger.verify_token')) {
            return new Response($request->get('hub_challenge'));
        }

        throw new NotFoundHttpException('Not found resources');
    }
79715
public function send(Request $request)
    {
        $response   = new PutResponse();
        $rpbPutReq  = $this->createRpbMessage($request);

        $this->client->send($rpbPutReq, RiakMessageCodes::SET_BUCKET_REQ, RiakMessageCodes::SET_BUCKET_RESP);

        return $response;
    }
416424
public function postAction(Request $request)
    {
        $action = $request->get('action');
        $document = $this->getDocumentManager()->create(self::DOCUMENT_TYPE);
        $locale = $this->getRequestParameter($request, 'locale', true);
        $data = $request->request->all();

        $this->persistDocument($data, $document, $locale);
        $this->handleActionParameter($action, $document, $locale);
        $this->getDocumentManager()->flush();

        return $this->handleView(
            $this->view($document)->setSerializationContext(
                SerializationContext::create()
                    ->setSerializeNull(true)
                    ->setGroups(['defaultPage', 'defaultArticle', 'smallArticlePage'])
            )
        );
    }
1118493
public function get(Request $request)
    {
        $userEntity = $request->attributes->get('user');

        if ($userEntity === null) {
            $userEntity = $this->getUser();
        } elseif ($userEntity === false) {
            return $this->createNotFoundResponse();
        }

        return $this->userArrayWithoutPassword($userEntity);
    }