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

  • CommentConnectionArgs
  • CommentConnectionDefinition
  • CommentConnectionResolver

Class CommentConnectionResolver

Class CommentConnectionResolver - Connects the comments to other objects

WPGraphQL\Data\ConnectionResolver implements WPGraphQL\Data\ConnectionResolverInterface
Extended by WPGraphQL\Type\Comment\Connection\CommentConnectionResolver
Namespace: WPGraphQL\Type\Comment\Connection
Package: WPGraphQL\Data\Resolvers
Located at Type/Comment/Connection/CommentConnectionResolver.php

Methods summary

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

This prepares the $query_args for use in the connection query. This is where default $args are set, where dynamic $args from the $source get set, and where mapping the input $args to the actual $query_args occurs.

This prepares the $query_args for use in the connection query. This is where default $args are set, where dynamic $args from the $source get set, and where mapping the input $args to the actual $query_args occurs.

Parameters

$source
$args
$context
$info

Returns

mixed
public static WP_Comment_Query
# get_query( $query_args )

Parameters

$query_args

Returns

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

Parameters

$query
The query that was processed to retrieve connection data
$items
The array of connected items
$source
The source being passed down the resolve tree
$args
The Input args for the field
$context
The AppContext passed down the resolve tree
$info
The ResolveInfo passed down the resolve tree

Returns

array

Overrides

WPGraphQL\Data\ConnectionResolver::get_connection
public static array
# get_edges( $items, $source, $args, $context, $info )

Takes an array of items and returns the edges

Takes an array of items and returns the edges

Parameters

$items
$source
$args
$context
$info

Returns

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

This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Comment_Query friendly keys.

This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_Comment_Query friendly keys.

There's probably a cleaner/more dynamic way to approach this, but this was quick. I'd be down to explore more dynamic ways to map this, but for now this gets the job done.

Parameters

$args
The array of query arguments
$source
The query results
$all_args

Array of all of the original arguments (not just the "where" args)

$context
The AppContext object
$info
The ResolveInfo object for the query

Returns

array

Since

0.0.5

Methods inherited from WPGraphQL\Data\ConnectionResolver

get_amount_requested(), get_array_meta(), get_array_slice(), get_offset(), get_query_amount(), get_query_info(), resolve()

API documentation generated by ApiGen