mirror of
https://github.com/retailcrm/graphql-php.git
synced 2025-02-06 07:49:24 +03:00
Removed last traces of field memoization
This commit is contained in:
parent
ca01900e9d
commit
afbd5dbc90
@ -48,11 +48,6 @@ class ExecutionContext
|
||||
*/
|
||||
public $errors;
|
||||
|
||||
/**
|
||||
* @var array
|
||||
*/
|
||||
public $memoized = [];
|
||||
|
||||
public function __construct($schema, $fragments, $root, $contextValue, $operation, $variables, $errors)
|
||||
{
|
||||
$this->schema = $schema;
|
||||
|
@ -707,17 +707,6 @@ class Executor
|
||||
return isset($tmp[$fieldName]) ? $tmp[$fieldName] : null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get an unique identifier for a FieldAST.
|
||||
*
|
||||
* @param object $fieldAST
|
||||
* @return string
|
||||
*/
|
||||
private static function getFieldUid($fieldAST, ObjectType $fieldType)
|
||||
{
|
||||
return $fieldAST->loc->start . '-' . $fieldAST->loc->end . '-' . $fieldType->name;
|
||||
}
|
||||
|
||||
/**
|
||||
* Complete a value of an abstract type by determining the runtime object type
|
||||
* of that value, then complete the value for that type.
|
||||
@ -846,24 +835,15 @@ class Executor
|
||||
$subFieldASTs = new \ArrayObject();
|
||||
$visitedFragmentNames = new \ArrayObject();
|
||||
|
||||
$fieldsCount = count($fieldASTs);
|
||||
for ($i = 0; $i < $fieldsCount; $i++) {
|
||||
// Get memoized value if it exists
|
||||
$uid = self::getFieldUid($fieldASTs[$i], $returnType);
|
||||
if (isset($exeContext->memoized['collectSubFields'][$uid])) {
|
||||
$subFieldASTs = $exeContext->memoized['collectSubFields'][$uid];
|
||||
} else {
|
||||
$selectionSet = $fieldASTs[$i]->selectionSet;
|
||||
if ($selectionSet) {
|
||||
$subFieldASTs = self::collectFields(
|
||||
$exeContext,
|
||||
$returnType,
|
||||
$selectionSet,
|
||||
$subFieldASTs,
|
||||
$visitedFragmentNames
|
||||
);
|
||||
$exeContext->memoized['collectSubFields'][$uid] = $subFieldASTs;
|
||||
}
|
||||
foreach ($fieldASTs as $fieldAST) {
|
||||
if (isset($fieldAST->selectionSet)) {
|
||||
$subFieldASTs = self::collectFields(
|
||||
$exeContext,
|
||||
$returnType,
|
||||
$fieldAST->selectionSet,
|
||||
$subFieldASTs,
|
||||
$visitedFragmentNames
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user