You are here

public function SubRequestBuffer::add in GraphQL 8.3

Add an item to the buffer.

Parameters

\Drupal\Core\Url $url: The url object to run the subrequest on.

callable $extract: The callback to run within the sub-request.

Return value

\Closure The callback to invoke to load the result for this buffer item.

File

src/GraphQL/Buffers/SubRequestBuffer.php, line 54

Class

SubRequestBuffer

Namespace

Drupal\graphql\GraphQL\Buffers

Code

public function add(Url $url, callable $extract) {
  $item = new \ArrayObject([
    'url' => $url,
    'extract' => $extract,
  ]);
  return $this
    ->createBufferResolver($item);
}