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

  • PostObjectConnectionArgs
  • PostObjectConnectionArgsDateQuery
  • PostObjectConnectionDefinition
  • PostObjectConnectionResolver

Class PostObjectConnectionResolver

Class PostObjectConnection - connects posts to other types

WPGraphQL\Data\ConnectionResolver implements WPGraphQL\Data\ConnectionResolverInterface
Extended by WPGraphQL\Type\PostObject\Connection\PostObjectConnectionResolver
Namespace: WPGraphQL\Type\PostObject\Connection
Package: WPGraphQL\Data\Resolvers
Since: 0.0.5
Located at Type/PostObject/Connection/PostObjectConnectionResolver.php

Methods summary

public
# __construct( $post_type )

PostObjectConnectionResolver constructor.

PostObjectConnectionResolver constructor.

Parameters

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

This returns the $query_args that should be used when querying for posts in the postObjectConnectionResolver. This checks what input $args are part of the query, combines them with various filters, etc and returns an array of $query_args to be used in the \WP_Query call

This returns the $query_args that should be used when querying for posts in the postObjectConnectionResolver. This checks what input $args are part of the query, combines them with various filters, etc and returns an array of $query_args to be used in the \WP_Query call

Parameters

$source
The query source being passed down to the resolver
$args
The arguments that were provided to the query
$context
Object containing app context that gets passed down the resolve tree
$info
Info about fields passed down the resolve tree

Returns

array
public static WP_Query
# get_query( $query_args )

This runs the query and returns the response

This runs the query and returns the response

Parameters

$query_args

Returns

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

This takes an array of items, the $args and the $query and returns the connection including the edges and page info

This takes an array of items, the $args and the $query and returns the connection including the edges and page info

Parameters

$query
The Query that was processed to get the connection data
$items
The array of items being connected
$source
$args The $args that were passed to the query
$args
$source The source being passed down the resolve tree
$context
The AppContext being 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_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.

This sets up the "allowed" args, and translates the GraphQL-friendly keys to WP_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
Query "where" args
$source
The query results for a query calling this
$all_args
All of the arguments for the query (not just the "where" args)
$context
The AppContext object
$info
The ResolveInfo object

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()

Properties summary

public static $post_type

Stores the name of the $post_type being resolved

Stores the name of the $post_type being resolved

#
public static integer $max_query_amount

Holds the maximum number of items that can be queried per request

Holds the maximum number of items that can be queried per request

# 100
API documentation generated by ApiGen