ElementResolver

Type
Abstract Class
Namespace
craft\gql\base
Inherits
craft\gql\base\ElementResolver » craft\gql\base\Resolver
Extended by
craft\gql\resolvers\elements\Asset, craft\gql\resolvers\elements\Category, craft\gql\resolvers\elements\Entry, craft\gql\resolvers\elements\GlobalSet, craft\gql\resolvers\elements\MatrixBlock, craft\gql\resolvers\elements\Tag, craft\gql\resolvers\elements\User
Since
3.3.0

Class ElementResolver

View source

Protected Properties

Public Methods

MethodDescription
getArrayableArguments()Returns a list of all the arguments that can be accepted as arrays.
prepareArguments()Prepare arguments for use, converting to array where applicable.
resolve()Resolve a field to its value.

getArrayableArguments()

Returns a list of all the arguments that can be accepted as arrays.

View source

Returns

array

resolve()

Resolve a field to its value.

View source

Arguments

  • $source (mixed) – The parent data source to use for resolving this field
  • $arguments (array) – Arguments for resolving this field.
  • $context (mixed) – The context shared between all resolvers
  • $resolveInfo (\GraphQL\Type\Definition\ResolveInfo) – The resolve information

Protected Methods

MethodDescription
extractEagerLoadCondition()Extract eager load conditions for a given resolve information. Preferrably at the very top of the query.
getPreloadableField()Get the preloadable field for the context or null if the field doesn't exist or is not preloadable.
prepareQuery()Prepare an element Query based on the source, arguments and the field name on the source.

prepareQuery()

Prepare an element Query based on the source, arguments and the field name on the source.

View source

Arguments

  • $source (mixed) – The source. Null if top-level field being resolved.
  • $arguments (array) – Arguments to apply to the query.
  • $fieldName (null) – Field name to resolve on the source, if not a top-level resolution.

Returns

mixed