You are here

protected function BufferBase::resolveBuffer in GraphQL 8.4

Same name and namespace in other branches
  1. 8.3 src/GraphQL/Buffers/BufferBase.php \Drupal\graphql\GraphQL\Buffers\BufferBase::resolveBuffer()

Resolves the given buffer wholly.

Parameters

\SplObjectStorage $buffer: The buffer to be resolved wholly.

Return value

\SplObjectStorage The resolved results for the given buffer, keyed by the corresponding buffer items.

1 call to BufferBase::resolveBuffer()
BufferBase::resolveItem in src/GraphQL/Buffers/BufferBase.php
Returns the result of the given item after processing the buffer if needed.

File

src/GraphQL/Buffers/BufferBase.php, line 122

Class

BufferBase
Base class for field buffering services.

Namespace

Drupal\graphql\GraphQL\Buffers

Code

protected function resolveBuffer(\SplObjectStorage $buffer) {

  // Convert the buffer to an array that we can later use to map the results
  // to the correct batch items.
  $buffer = iterator_to_array($buffer, FALSE);

  // Assign the loaded items to their corresponding batch items.
  $output = new \SplObjectStorage();
  foreach ($this
    ->resolveBufferArray($buffer) as $key => $item) {
    $output
      ->attach($buffer[$key], $item);
  }
  return $output;
}