@param \Symfony\Component\HttpFoundation\Request $request
@param \Sensio\Bundle\FrameworkExtraBundle\Configuration\ParamConverter $configuration

@return bool

@throws \eZ\Publish\API\Repository\Exceptions\NotFoundException
177571
public function apply(Request $request, ParamConverter $configuration)
    {
        $id = (int)$request->get(self::PARAMETER_OBJECT_STATE_ID);
        $objectState = $this->objectStateService->loadObjectState($id);

        if (!$objectState) {
            throw new NotFoundHttpException("Object State $id not found!");
        }

        $request->attributes->set($configuration->getName(), $objectState);

        return true;
    }
638571
public function apply(Request $request, ParamConverterConfig $configuration)
    {
        $this->convertClassParamToClassName($configuration);

        return parent::apply($request, $configuration);
    }
21695
protected function isGrantedOr403(SyliusRequestConfiguration $configuration, string $permission): void
    {
        if (!$configuration->hasPermission()) {
            $permission = $this->getRoleName($permission);
            if (!$this->authorizationChecker->isGranted($configuration, $permission)) {
                throw $this->createAccessDeniedException();
            }
            return;
        }

        $permission = $configuration->getPermission($permission);
        if (!$this->authorizationChecker->isGranted($configuration, $permission)) {
            throw $this->createAccessDeniedException();
        }

        return;
    }
599883
public function moveMediaAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

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

        /** @var \Ekyna\Bundle\MediaBundle\Model\MediaInterface $media */
        $media = $this->get('ekyna_media.media.repository')->find($request->attributes->get('mediaId'));
        if (null === $media) {
            throw new NotFoundHttpException('Media not found.');
        }

        if ($folder === $media->getFolder()) {
            $result = array('success' => true);
        } else {
            $media->setFolder($folder);
            $event = $this->get('ekyna_media.media.operator')->update($media);
            if (!$event->hasErrors()) {
                $result = array('success' => true);
            } else {
                $result = array('success' => false);
            }
        }

        $response = new Response(json_encode($result));
        $response->headers->add(array('Content-Type' => 'application/json'));
        return $response;
    }
63561
public function bulkNewAction(Request $request)
    {
        /** @var ConfiguratorFactory $configuratorFactory */
        $configuratorFactory = $this->getConfiguratorFactory($this->getClassName());
        /** @var PluginConfigurator $pluginConfigurator */
        $pluginConfigurator = $configuratorFactory->getConfigurator(PluginConfigurator::class);

        if (!$pluginConfigurator->isBulkInsertEnabled()) {
            throw new NotFoundHttpException($this->get('translator')->trans('message.request_not_found', array(), $this->getParameter('symfonyid.admin.translation_domain')));
        }

        /** @var CrudConfigurator $crudConfigurator */
        $crudConfigurator = $configuratorFactory->getConfigurator(CrudConfigurator::class);

        $this->isGrantedOr404Error($crudConfigurator, Constants::ACTION_CREATE);

        $driver = $this->get('symfonyid.admin.manager.driver_finder')->findDriverForClass($crudConfigurator->getCrud()->getModelClass());
        $crudFactory = $this->get('symfonyid.admin.crud.crud_factory');
        $crudFactory->setView($this->get('symfonyid.admin.view.view'));
        $crudFactory->setDriver($driver);
        $crudFactory->setRequest($request);

        return $crudFactory->bulkCreate($crudConfigurator);
    }
1126717
public function createByTypeAction($id, Request $request)
    {
        $contentType = $this->contentTypeManager->getContentTypeById($id);

        if ($contentType === null) {
            throw EntityNotFoundException::fromClassNameAndIdentifier(
                $this->configurationManager->getEntityClass('content_type'),
                [$id]
            );
        }

        $contentEntityClass = $this->configurationManager->getEntityClass('content');
        $content = new $contentEntityClass;
        $content->setContentType($contentType);

        $form = $this->createForm(ContentType::class, $content, [
            'action' => $this->generateUrl('sherlockode_acb_content_create_by_type', ['id' => $contentType->getId()]),
            'contentType' => $content->getContentType(),
        ]);
        $form->handleRequest($request);

        if ($form->isSubmitted() && $form->isValid()) {
            $this->om->persist($content);
            $this->om->flush();

            return $this->redirectToRoute('sherlockode_acb_content_edit', ['id' => $content->getId()]);
        }

        return $this->render('@SherlockodeAdvancedContent/Content/edit_content.html.twig', [
            'form' => $form->createView(),
            'is_ajax' => $request->isXmlHttpRequest(),
        ]);
    }
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);
	}
648127
public function apply(Request $request, ParamConverter $configuration)
    {
        $name = $configuration->getName();
        $repo = null;

        if (null != $request->attributes->get('id')) {
            $repo = $this->findById($request);
        } else {
            if (null != $request->attributes->get('slug')) {
                $repo = $this->findBySlug($request);
            }
        }

        if ($repo) {
            $request->attributes->set($name, $repo);

            return true;
        }

        return false;
    }
449578
public function supports(ParamConverter $configuration)
    {
        if (null === $configuration->getClass()) {
            return false;
        }

        if(array_key_exists($configuration->getClass(), $this->targetEntitiesArray))
        {
            return true;
        }
        else
        {
            return false;
        }
    }
826817
private function isConvertedAttribute(Request $request, ParamConverter $configuration): bool
    {
        if (false === $request->attributes->has(Rest\Action::NAME)) {
            return false;
        }

        $attributes = $request->attributes->get(Rest\Action::NAME)->getAttributes();

        return in_array($configuration->getName(), $attributes);
    }
1139886
public function requireIfAvailableOr(Configuration $configuration, array $params)
  {
    $requiredIfAvailable = $configuration->getOptions()->getRequiredIfAvailable();
    foreach ($requiredIfAvailable->getOr() as $key)
    {
      if (array_key_exists(strtolower($key), $params))
      {
        return true;
        break;
      }
    }

    return false;
  }
318251
public static function generateFromRequest(Request $request, array $mapping = array())
    {
        $configuration = new static();

        $configuration->setPaginateConfiguration(
            $request->get('order'),
            $request->get('start'),
            $request->get('length'),
            $mapping,
            $request->get('search')
        );

        return $configuration;
    }
30760
public function apply(Request $request, ParamConverter $configuration)
    {
        $name = $configuration->getName();
        $class = $configuration->getClass();
        $options = $this->getOptions($configuration);

        $reflectionClass = new ReflectionClass($class);
        if (!$reflectionClass->implementsInterface('Ehann\Bundle\WebServiceBundle\Request\IWebServiceRequest')) {
            return false;
        }

        if (null === $request->attributes->get($name, false)) {
            $configuration->setIsOptional(true);
        }

        $object = $this->find($class, $request, $options, $name);
        if ($object === false && $request->isMethod('GET')) {
            $object = $this->findOneBy($class, $request, $options);
        } else if ($request->isMethod('POST')) {
            $requestObject = new $class;
            $keys = array_keys($request->request->all());
            $options['mapping'] = $keys ? array_combine($keys, $keys) : array();
            $em = $this->getManager($options['entity_manager'], $class);
            $metadata = $em->getClassMetadata($class);

            foreach ($options['mapping'] as $parameter => $field) {
                if ($metadata->hasField($field) || ($metadata->hasAssociation($field) && $metadata->isSingleValuedAssociation($field))) {
                    $methodSuffix = ucfirst($field);
                    $setMethodName = 'set' . $methodSuffix;
                    $value = $request->request->get($parameter);
                    if ('datetime' === $metadata->getTypeOfField($field)) {
                        try {
                            $value = new \DateTime($value);
                        } catch (\Exception $exception) {
                            throw new NotFoundHttpException('Invalid date given.', $exception);
                        }
                    }
                    if (method_exists($requestObject, $setMethodName)) {
                        $requestObject->{$setMethodName}($value);
                    }
                }
            }

            if ($object !== false) {
                // Merge
                foreach ($metadata->getFieldNames() as $fieldName => $fieldType) {
                    $methodSuffix = ucfirst($fieldName);
                    $getMethodName = 'get' . $methodSuffix;
                    $value = $requestObject->{$getMethodName}();
                    if (is_null($value)) {
                        $value = $object->{$getMethodName}();
                    }
                    $setMethodName = 'set' . $methodSuffix;
                    if (method_exists($requestObject, $setMethodName)) {
                        $requestObject->{$setMethodName}($value);
                    }
                }
            }
            $object = $requestObject;
        }

        if ($object === false && !$configuration->isOptional()) {
            throw new NotFoundHttpException(sprintf('%s object not found.', $class));
        }

        $request->attributes->set($name, $object);

        return true;
    }
1075728
public function toggleFiltrableAction(Request $request, $id)
    {
        if (false === $request->isXmlHttpRequest()) {
            throw $this->createNotFoundException();
        }

        $isFiltrable = $this->get('admin_manager')->toggleFiltrable('EcommerceBundle:Feature', $id);

        return new Response(intval($isFiltrable), 200);
    }
920059
protected function getConfiguration(Request $request = null)
    {
        if (!$this->configuration) {
            if (!$request) {
                throw new \RuntimeException('The first time getConfiguration() is called, you must pass a Request.');
            }

            $this->configuration = new Configuration($request);
            $this->configure($request, $this->configuration);
            $this->configuration->validate();
        }

        return $this->configuration;
    }
1266939
private function shouldRedirect(FormInterface $form, Request $request, AdminConfiguration $configuration)
    {
        if (!$form->isSubmitted()) {
            return false;
        }

        if (!$form->isValid()) {
            return false;
        }

        if (!key_exists('list', $configuration->getParameter('actions'))) {
            return false;
        }

        if (!$request->get('submit_and_redirect')) {
            return false;
        }

        if ('submit_and_redirect' !== $request->get('submit_and_redirect')) {
            return false;
        }

        return true;
    }
531703
public function importMediaAction(Request $request)
    {
        if (!$request->isXmlHttpRequest()) {
            throw new NotFoundHttpException();
        }

        $modal = $this->createModal();
        $modal->setTitle('ekyna_media.import.title');

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

        $import = new MediaImport($folder);

        $flow = $this->get('ekyna_media.import_media.form_flow');
        $flow->bind($import);

        $form = $flow->createForm();
        if ($flow->isValid($form)) {
            $flow->saveCurrentStepData($form);

            if ($flow->nextStep()) {
                $form = $flow->createForm();
            } else {
                // TODO use ResourceManager
                $operator = $this->get('ekyna_media.media.operator');
                foreach ($import->getMedias() as $media) {
                    $event = $operator->create($media);
                    if ($event->isPropagationStopped()) {
                        $this->addFlash(sprintf('Failed to create "%s" media.', $media->getPath()), 'danger');
                    }
                }

                $modal->setContent(array('success' => true));
                return $this->get('ekyna_core.modal')->render($modal);
            }
        }

        $modal->setContent($form->createView());

        return $this->get('ekyna_core.modal')->render($modal);
    }