mirror of
https://github.com/retailcrm/graphql-php.git
synced 2024-11-25 06:16:05 +03:00
Do not mess with original value in executor. Copy it instead.
This commit is contained in:
parent
913caf33ec
commit
83e33659cb
@ -193,7 +193,6 @@ class Executor
|
|||||||
* @param ExecutionContext $exeContext
|
* @param ExecutionContext $exeContext
|
||||||
* @param ObjectType $parentType
|
* @param ObjectType $parentType
|
||||||
* @param $sourceList
|
* @param $sourceList
|
||||||
* @param $sourceIsList
|
|
||||||
* @param $fields
|
* @param $fields
|
||||||
* @return array
|
* @return array
|
||||||
* @throws Error
|
* @throws Error
|
||||||
@ -598,8 +597,11 @@ class Executor
|
|||||||
$resultTypeMap = [];
|
$resultTypeMap = [];
|
||||||
$typeNameMap = [];
|
$typeNameMap = [];
|
||||||
$cursors = [];
|
$cursors = [];
|
||||||
|
$copied = [];
|
||||||
|
|
||||||
foreach ($result as $index => $item) {
|
foreach ($result as $index => $item) {
|
||||||
|
$copied[$index] = $item;
|
||||||
|
|
||||||
if (null !== $item) {
|
if (null !== $item) {
|
||||||
$objectType = $itemType->getObjectType($item, $info);
|
$objectType = $itemType->getObjectType($item, $info);
|
||||||
|
|
||||||
@ -607,7 +609,7 @@ class Executor
|
|||||||
$exeContext->addError(new Error(
|
$exeContext->addError(new Error(
|
||||||
"Runtime Object type \"$objectType\" is not a possible type for \"$itemType\"."
|
"Runtime Object type \"$objectType\" is not a possible type for \"$itemType\"."
|
||||||
));
|
));
|
||||||
$result[$index] = null;
|
$copied[$index] = null;
|
||||||
} else {
|
} else {
|
||||||
$listPerObjectType[$objectType->name][] = $item;
|
$listPerObjectType[$objectType->name][] = $item;
|
||||||
$resultTypeMap[$index] = $objectType->name;
|
$resultTypeMap[$index] = $objectType->name;
|
||||||
@ -626,7 +628,7 @@ class Executor
|
|||||||
|
|
||||||
// Restore order:
|
// Restore order:
|
||||||
$completed = [];
|
$completed = [];
|
||||||
foreach ($result as $index => $item) {
|
foreach ($copied as $index => $item) {
|
||||||
if (null === $item) {
|
if (null === $item) {
|
||||||
// Complete nulls separately
|
// Complete nulls separately
|
||||||
$completed[] = self::completeValueCatchingError($exeContext, $itemType, $fieldASTs, $info, $item);
|
$completed[] = self::completeValueCatchingError($exeContext, $itemType, $fieldASTs, $info, $item);
|
||||||
|
Loading…
Reference in New Issue
Block a user