ElementResolver
- Type
- Abstract Class
- Namespace
- craft\gql\base
- Inherits
- craft\gql\base\ElementResolver » craft\gql\base\Resolver
- Extended by
- craft\gql\resolvers\elements\Address, 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 (opens new window)
# Public Methods
Method | Description |
---|---|
resolve() | Resolve a field to its value. |
resolveCount() | Resolve an element query to a total count of elements. |
resolveOne() | Resolve an element query to a single result. |
# resolve()
Resolve a field to its value.
View source (opens new window)
Arguments
$source
(mixed
) – The parent data source to use for resolving this field$arguments
(array (opens new window)) – Arguments for resolving this field.$context
(mixed
) – The context shared between all resolvers$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
) – The resolve information
Returns
mixed
# resolveCount()
Resolve an element query to a total count of elements.
View source (opens new window)
Arguments
$source
(mixed
)$arguments
(array (opens new window))$context
(array (opens new window), null (opens new window))$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
)
Returns
mixed
# resolveOne()
Resolve an element query to a single result.
View source (opens new window)
Arguments
$source
(mixed
)$arguments
(array (opens new window))$context
(mixed
)$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
)
Returns
mixed
# Protected Methods
Method | Description |
---|---|
prepareElementQuery() | Prepare an element query for given resolution argument set. |
prepareQuery() | Prepare an element Query based on the source, arguments and the field name on the source. |
# prepareElementQuery()
Prepare an element query for given resolution argument set.
View source (opens new window)
Arguments
$source
(mixed
)$arguments
(array (opens new window))$context
(array (opens new window), null (opens new window))$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
)
Returns
craft\elements\db\ElementQuery, \Illuminate\Support\Collection
# prepareQuery()
Prepare an element Query based on the source, arguments and the field name on the source.
View source (opens new window)
Arguments
$source
(mixed
) – The source. Null if top-level field being resolved.$arguments
(array (opens new window)) – Arguments to apply to the query.$fieldName
(string (opens new window), null (opens new window)) – Field name to resolve on the source, if not a top-level resolution.
Returns
mixed