class QueryUser in Open Social 10.1.x
Same name and namespace in other branches
- 10.0.x modules/social_features/social_user/src/Plugin/GraphQL/DataProducer/QueryUser.php \Drupal\social_user\Plugin\GraphQL\DataProducer\QueryUser
Queries the users on the platform.
Plugin annotation
@DataProducer(
id = "query_user",
name = @Translation("Query a list of users"),
description = @Translation("Retrieves a list of teas."),
produces = @ContextDefinition("any",
label = @Translation("User connection")
),
consumes = {
"first" = @ContextDefinition("integer",
label = @Translation("First"),
required = FALSE
),
"after" = @ContextDefinition("string",
label = @Translation("After"),
required = FALSE
),
"last" = @ContextDefinition("integer",
label = @Translation("Last"),
required = FALSE
),
"before" = @ContextDefinition("string",
label = @Translation("Before"),
required = FALSE
),
"reverse" = @ContextDefinition("boolean",
label = @Translation("Reverse"),
required = FALSE,
default_value = FALSE
),
"sortKey" = @ContextDefinition("string",
label = @Translation("Sort key"),
required = FALSE,
default_value = "CREATED_AT"
),
}
)
Hierarchy
- class \Drupal\social_graphql\Plugin\GraphQL\DataProducer\Entity\EntityDataProducerPluginBase extends \Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerPluginBase implements ContainerFactoryPluginInterface
- class \Drupal\social_user\Plugin\GraphQL\DataProducer\QueryUser
Expanded class hierarchy of QueryUser
File
- modules/
social_features/ social_user/ src/ Plugin/ GraphQL/ DataProducer/ QueryUser.php, line 50
Namespace
Drupal\social_user\Plugin\GraphQL\DataProducerView source
class QueryUser extends EntityDataProducerPluginBase {
/**
* Resolves the request to the requested values.
*
* @param int|null $first
* Fetch the first X results.
* @param string|null $after
* Cursor to fetch results after.
* @param int|null $last
* Fetch the last X results.
* @param string|null $before
* Cursor to fetch results before.
* @param bool $reverse
* Reverses the order of the data.
* @param string $sortKey
* Key to sort by.
* @param \Drupal\Core\Cache\RefinableCacheableDependencyInterface $metadata
* Cacheability metadata for this request.
*
* @return \Drupal\social_graphql\GraphQL\ConnectionInterface
* An entity connection with results and data about the paginated results.
*
* @todo https://www.drupal.org/project/social/issues/3191622
* @todo https://www.drupal.org/project/social/issues/3191637
*/
public function resolve(?int $first, ?string $after, ?int $last, ?string $before, bool $reverse, string $sortKey, RefinableCacheableDependencyInterface $metadata) {
$query_helper = new UserQueryHelper($this->graphqlEntityBuffer, $this->entityTypeManager, $sortKey);
$metadata
->addCacheableDependency($query_helper);
$connection = new EntityConnection($query_helper);
$connection
->setPagination($first, $after, $last, $before, $reverse);
return $connection;
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
EntityDataProducerPluginBase:: |
protected | property | The entity type manager service. | |
EntityDataProducerPluginBase:: |
protected | property | The GraphQL entity buffer. | |
EntityDataProducerPluginBase:: |
protected | property | The GraphQL entity revision buffer. | |
EntityDataProducerPluginBase:: |
protected | property | The GraphQL entity UUID buffer. | |
EntityDataProducerPluginBase:: |
public static | function |
@codeCoverageIgnore Overrides ContainerFactoryPluginInterface:: |
|
EntityDataProducerPluginBase:: |
public | function | EntityLoad constructor. | |
QueryUser:: |
public | function | Resolves the request to the requested values. |