You are here

public function EntityListResponse::items in Thunder 6.2.x

Retrieve the entity list.

Return value

array|\GraphQL\Deferred The entity list.

File

modules/thunder_gqls/src/Wrappers/EntityListResponse.php, line 48

Class

EntityListResponse
The thunder entity list response class.

Namespace

Drupal\thunder_gqls\Wrappers

Code

public function items() {
  $result = $this->query
    ->execute();
  if (empty($result)) {
    return [];
  }
  $buffer = \Drupal::service('graphql.buffer.entity');
  $callback = $buffer
    ->add($this->query
    ->getEntityTypeId(), array_values($result));
  return new Deferred(function () use ($callback) {
    return $callback();
  });
}