You are here

public function QueryUser::resolve in Open Social 10.0.x

Same name and namespace in other branches
  1. 10.1.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/QueryUser.php \Drupal\social_user\Plugin\GraphQL\DataProducer\QueryUser::resolve()

Resolves the request to the requested values.

@todo https://www.drupal.org/project/social/issues/3191622 @todo https://www.drupal.org/project/social/issues/3191637

Parameters

int|null $first: Fetch the first X results.

string|null $after: Cursor to fetch results after.

int|null $last: Fetch the last X results.

string|null $before: Cursor to fetch results before.

bool $reverse: Reverses the order of the data.

string $sortKey: Key to sort by.

\Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata: Cacheability metadata for this request.

Return value

\Drupal\social_graphql\GraphQL\ConnectionInterface An entity connection with results and data about the paginated results.

File

modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/QueryUser.php, line 76

Class

QueryUser
Queries the users on the platform.

Namespace

Drupal\social_user\Plugin\GraphQL\DataProducer

Code

public function resolve(?int $first, ?string $after, ?int $last, ?string $before, bool $reverse, string $sortKey, RefinableCacheableDependencyInterface $metadata) {
  $query_helper = new UserQueryHelper($this->entityTypeManager, $sortKey);
  $metadata
    ->addCacheableDependency($query_helper);
  $connection = new EntityConnection($query_helper);
  $connection
    ->setPagination($first, $after, $last, $before, $reverse);
  return $connection;
}