Overview
  • Namespace
  • Class

Namespaces

  • WPGraphQL
    • Data
    • Type
      • Avatar
      • Comment
        • Connection
      • CommentAuthor
      • EditLock
      • Enum
      • MediaItem
        • Mutation
      • Plugin
        • Connection
      • PostObject
        • Connection
        • Mutation
      • PostType
      • Setting
      • Taxonomy
      • TermObject
        • Connection
        • Mutation
      • Theme
        • Connection
      • Union
      • User
        • Connection
        • Mutation
    • Utils

Classes

  • Config
  • ConnectionResolver
  • DataSource
  • Loader

Interfaces

  • ConnectionResolverInterface

Class ConnectionResolver

Class Connections

This class is meant to be extended by ConnectionResolvers

WPGraphQL\Data\ConnectionResolver implements WPGraphQL\Data\ConnectionResolverInterface

Direct known subclasses

WPGraphQL\Type\Comment\Connection\CommentConnectionResolver, WPGraphQL\Type\PostObject\Connection\PostObjectConnectionResolver, WPGraphQL\Type\TermObject\Connection\TermObjectConnectionResolver, WPGraphQL\Type\User\Connection\UserConnectionResolver

Abstract
Namespace: WPGraphQL\Data
Package: WPGraphQL\Data
Located at Data/ConnectionResolver.php

Methods summary

public static array
# resolve( mixed $source, array $args, WPGraphQL\AppContext $context, GraphQL\Type\Definition\ResolveInfo $info )

Runs the query for comments

Runs the query for comments

Parameters

$source
Data returned from the query
$args
Args for the query
$context
AppContext object for the query
$info
ResolveInfo object

Returns

array

Throws

Exception

Since

0.5.0
public static array
# get_connection( mixed $query, array $array, mixed $source, array $args, WPGraphQL\AppContext $context, GraphQL\Type\Definition\ResolveInfo $info )

Take an array return a connection

Take an array return a connection

Parameters

$query
The query being performed
$array
The array of connection items
$source
The source being passed down the resolve tree
$args
The args for the field being resolved
$context
The context being passed down the Resolve tree
$info
The ResolveInfo for the field being resolved

Returns

array
public static array
# get_array_slice( mixed $query, array $args )

This returns a slice of the query results based on the posts retrieved and the $args passed to the query

This returns a slice of the query results based on the posts retrieved and the $args passed to the query

Parameters

$query
The query that was made to fetch the items
$args
array of arguments input in the field as part of the GraphQL query

Returns

array
public static integer|null
# get_amount_requested( array $args )

This checks the $args to determine the amount requested, and if

This checks the $args to determine the amount requested, and if

Parameters

$args
array of arguments input in the field as part of the GraphQL query

Returns

integer|null

Throws

Exception
public static mixed
# get_query_amount( $source, $args, $context, $info )

get_query_amount

get_query_amount

Returns the max between what was requested and what is defined as the $max_query_amount to ensure that queries don't exceed unwanted limits when querying data.

Parameters

$source
$args
$context
$info

Returns

mixed
public static array
# get_array_meta( mixed $query, array $args )

This returns a meta array to be used in preparing the connection edges

This returns a meta array to be used in preparing the connection edges

Parameters

$query
The query that was made to fetch the items
$args
array of arguments input in the field as part of the GraphQL query

Returns

array
public static integer|mixed
# get_offset( $args )

This returns the offset to be used in the $query_args based on the $args passed to the GraphQL query.

This returns the offset to be used in the $query_args based on the $args passed to the GraphQL query.

Parameters

$args

Returns

integer|mixed
public static integer
# get_query_info( mixed $query )

WordPress has different queries that return date in different shapes. This normalizes the return for re-use.

WordPress has different queries that return date in different shapes. This normalizes the return for re-use.

Parameters

$query
The query that was made to fetch the items

Returns

integer

Methods inherited from WPGraphQL\Data\ConnectionResolverInterface

get_query(), get_query_args(), sanitize_input_fields()

API documentation generated by ApiGen