You are here

public function EntityUuidBuffer::add in GraphQL 8.4

Add an item to the buffer.

Parameters

string $type: The entity type of the given entity ids.

array|string $uuid: The entity uuid(s) to load.

Return value

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

File

src/GraphQL/Buffers/EntityUuidBuffer.php, line 42

Class

EntityUuidBuffer
Collects entity UUIDs per entity type and loads them all at once in the end.

Namespace

Drupal\graphql\GraphQL\Buffers

Code

public function add($type, $uuid) {
  $item = new \ArrayObject([
    'type' => $type,
    'uuid' => $uuid,
  ]);
  return $this
    ->createBufferResolver($item);
}