SilverStripe\GraphQL\Pagination\Connection
A connection to a list of items on a object type. Collections are paginated and return a list of edges.
<code>
friends(limit:2,offset:2,sortBy:[{field:Name,direction:ASC}]) {
edges {
node {
name
}
}
pageInfo {
totalCount
hasPreviousPage
hasNextPage
}
}
</code>
Synopsis
class Connection
implements
OperationResolver
{
- // members
- protected $connectionName;
- protected ObjectType|Callable $connectedType;
- protected ObjectType $connectionTypeInstance;
- protected $description;
- protected Callable $connectionResolver;
- protected array $args = ;
- protected array $sortableFields = ;
- protected integer $defaultLimit = 100;
- protected integer $maximumLimit = 100;
- // methods
- public void __construct()
- public $this setConnectionResolver()
- public $this setConnectionType()
- public ObjectType|Callable getConnectionType()
- public Callable getConnectionResolver()
- public $this setArgs()
- public $this setDescription()
- public string getDescription()
- public $this setSortableFields()
- public array getSortableFields()
- public $this setDefaultLimit()
- public int getDefaultLimit()
- public $this setMaximumLimit()
- public string getConnectionTypeName()
- public string getEdgeTypeName()
- public array args()
- public array fields()
- public ObjectType getEdgeType()
- public ObjectType toType()
- public array resolve()
- public array resolveList()
- protected SS_List applySort()
- // Inherited methods from PermissionCheckerAware
- public $this setPermissionChecker()
- public QueryPermissionChecker getPermissionChecker()
Hierarchy
Uses
- SilverStripe\Core\Injector\Injectable
- SilverStripe\GraphQL\Permission\PermissionCheckerAware
Implements
Members
protected
- $args — array
- $connectedType
—
SilverStripe\GraphQL\Pagination\ObjectType|Callable
Return a thunk function, which in turn returns the lazy-evaluated {@link ObjectType}. - $connectionName — string
- $connectionResolver — SilverStripe\GraphQL\Pagination\Callable
- $connectionTypeInstance
—
GraphQL\Type\Definition\ObjectType
Cache the instance of the connection type to guarantee referential equality for graphql-php - $defaultLimit — int
- $description — string
- $maximumLimit
—
int
The maximum limit supported for the connection. Used to prevent excessive load on the server. To override the default limit, use {@link setLimits} - $permissionChecker — SilverStripe\GraphQL\Permission\QueryPermissionChecker
- $sortableFields — array
Methods
protected
public
- __construct()
- args() — Pagination support for the connection type. Currently doesn't support cursors, just basic offset pagination.
- fields()
- getConnectionResolver()
- getConnectionType() — Evaluate Connection type
- getConnectionTypeName()
- getDefaultLimit()
- getDescription()
- getEdgeType()
- getEdgeTypeName()
- getSortableFields()
- resolve() — Returns the collection resolved with the pageInfo provided.
- resolveList() — Wraps an {@link SS_List} with the required data in order to return it as a response. If you wish to resolve a standard array as a list use {@link ArrayList}.
- setArgs()
- setConnectionResolver()
- setConnectionType() — Pass in the {@link ObjectType}.
- setDefaultLimit()
- setDescription()
- setMaximumLimit()
- setSortableFields()
- toType()