@param Request     $request
@param string|null $schemaName
@param bool        $batched

@return array
481642
private function processQuery(Request $request, string $schemaName = null, bool $batched): array
    {
        if ($batched) {
            $payload = $this->processBatchQuery($request, $schemaName);
        } else {
            $payload = $this->processNormalQuery($request, $schemaName);
        }

        return $payload;
    }
811368
protected function executeBatched(GraphQLRequest $request): array
    {
        $results = [];
        do {
            $results[] = $this->graphQL->executeRequest($request);
        } while ($request->advanceBatchIndex());

        return $results;
    }
1221715
public function schemaTemplate($schemaName)
    {
        return [
            'exists' => (new Query())
                ->select('nspname')
                ->from('pg_namespace')
                ->where('nspname = :value', [':value' => $schemaName])
                ->exists($this->db),
            'up' => "CREATE SCHEMA $schemaName",
            'down' => "DROP SCHEMA $schemaName",
        ];
    }
729763
public function getAttributeByName(Request $request, string $name): array
    {
        $matches = \array_filter($this->getReleasedAttributes($request), function ($key) use ($name) {
            return \strtoupper($name) == \strtoupper($key);
        }, ARRAY_FILTER_USE_KEY);
        if (empty($matches)) {
            return [];
        } else {
            return \current($matches);
        }
    }
138
public function schemaAction(Request $request)
    {
        $api = $this->decideApiAndEndpoint($request->getUri());
        $this->registerProxySources($api['apiName']);
        $this->apiLoader->addOptions($api);

        $schema = $this->apiLoader->getEndpointSchema(urldecode($api['endpoint']));
        $schema = $this->transformationHandler->transformSchema(
            $api['apiName'],
            $api['endpoint'],
            $schema,
            clone $schema
        );
        $response = new Response(json_encode($schema), 200);
        $response->headers->set('Content-Type', 'application/json');

        return $this->templating->renderResponse(
            'GravitonCoreBundle:Main:index.json.twig',
            array ('response' => $response->getContent()),
            $response
        );
    }
1130410
public function extractData(Request $request)
    {
        $data = $request->data();
        $entityData = array();
        $inputName = $this->getInputName();

        if (!array_key_exists($inputName, $data)) {
            return array();
        }

        $entityData = $data[$inputName];
        $filteredData = array();

        foreach ($this->getAttributeNames() as $key) {
            if (array_key_exists($key, $entityData)) {
                $filteredData[$key] = $entityData[$key];
            }
        }

        return $filteredData;
    }
782925
public function listAction(Request $request = null)
    {
        $this->admin->checkAccess('list');

        if ($listMode = $request->get('_list_mode')) {
            $this->admin->setListMode($listMode);
        }

        $datagrid = $this->admin->getDatagrid();
        $datagrid->setValue('context', null, $this->admin->getPersistentParameter('context'));

        $formView = $datagrid->getForm()->createView();

        // set the theme for the current Admin Form
        $this->setFormTheme($formView, $this->admin->getFilterTheme());

        return $this->render($this->admin->getTemplate('list'), [
            'action' => 'list',
            'form' => $formView,
            'datagrid' => $datagrid,
            'csrf_token' => $this->getCsrfToken('sonata.batch'),
        ]);
    }
1243434
public function sendBatchRequest(BatchRequest $request)
    {
        $response = $this->sendRequest($request);

        return new BatchResponse($request, $response);
    }
1277459
public function getJsonParams(Request $request)
    {
        $request_params = [];

        if (0 === mb_strpos($request->headers->get('Content-Type'), 'application/json')) {
            $request_params = json_decode($request->getContent(), true);
        }

        return $request_params;
    }
222066
public function parse(Request $request): array
    {
        // Extracts the GraphQL request parameters
        $queries = $this->getParsedBody($request);

        if (empty($queries)) {
            throw new BadRequestHttpException('Must provide at least one valid query.');
        }

        foreach ($queries as $i => &$query) {
            $query = \array_filter($query) + self::$queriesDefaultValue;

            if (!\is_string($query[static::PARAM_QUERY])) {
                throw new BadRequestHttpException(\sprintf('%s is not a valid query', \json_encode($query[static::PARAM_QUERY])));
            }
        }

        return $queries;
    }
437981
public function findUnhydratedEntities(Request $request, $filters = array(), $addPagination = false)
    {
        $options = $this->getOptions($request, $filters, $addPagination, true);
        if (!$addPagination) {
            return array(
                'entities' => $this->getRepository()->getEntities($options, AbstractQuery::HYDRATE_ARRAY),
                'options' => $options
            );
        }

        $entities = $this->getRepository()->getPaginatedEntities($options, AbstractQuery::HYDRATE_ARRAY);
        $options['elements'] = $entities->count();
        $options['pages'] = (int)ceil($options['elements'] / $options['elementsPerPage']);

        return array(
            'entities' => (array)$entities->getIterator(),
            'options' => $options
        );
    }
307722
public function getCalledListeners(/* Request $request = null */)
    {
        if (null === $this->callStack) {
            return [];
        }

        $hash = 1 <= \func_num_args() && null !== ($request = \func_get_arg(0)) ? spl_object_hash($request) : null;
        $called = [];
        foreach ($this->callStack as $listener) {
            list($eventName, $requestHash) = $this->callStack->getInfo();
            if (null === $hash || $hash === $requestHash) {
                $called[] = $listener->getInfo($eventName);
            }
        }

        return $called;
    }
658896
public function schema($request)
    {
        $formName = $request->param('FormName');
        if ($formName !== 'fileHistoryForm') {
            return parent::schema($request);
        }

        // Get schema for history form
        // @todo Eventually all form scaffolding will be based on context rather than record ID
        // See https://github.com/silverstripe/silverstripe-framework/issues/6362
        $itemID = $request->param('ItemID');
        $version = $request->param('OtherItemID');
        $form = $this->getFileHistoryForm([
            'RecordID' => $itemID,
            'RecordVersion' => $version,
        ]);

        // Respond with this schema
        $response = $this->getResponse();
        $response->addHeader('Content-Type', 'application/json');
        $schemaID = $this->getRequest()->getURL();
        return $this->getSchemaResponse($schemaID, $form);
    }
564682
protected function _getSchemaCache($modelName = null) {
		if (empty($modelName)) {
			return null;
		}

		$modelName = (string)$modelName;
		if (!isset($this->_schemaCache[$modelName])) {
			return null;
		}

		return $this->_schemaCache[$modelName];
	}
889881
private function getContentFromRequest(Request $request): array
    {
        $data = json_decode($request->getContent(), true);
        foreach ($data as $key => $value) {
            if ($value === null || $value === '') {
                unset($data[$key]);
            }
        }
        return $data;
    }
1146448
public function batchActionDisable(ProxyQuery $selectedModelQuery, Request $request)
    {
        return $this->batchActionEnabled($selectedModelQuery, $request, false);
    }
217682
public function batchActionEnable(ProxyQuery $selectedModelQuery, Request $request = null)
    {
        return $this->batchActionEnabled($selectedModelQuery, $request, true);
    }