Variant
- Type
- Class
- Namespace
- craft\commerce\gql\resolvers\elements
- Inherits
- craft\commerce\gql\resolvers\elements\Variant » craft\gql\base\ElementResolver (opens new window) » craft\gql\base\Resolver (opens new window)
- Since
- 3.1
Class Variant
View source (opens new window)
# Protected Properties
Property | Description |
---|---|
eagerLoadableFieldsByContext (opens new window) | array (opens new window) – Cache fields by context. |
# Public Methods
Method | Description |
---|---|
getArrayableArguments() (opens new window) | Returns a list of all the arguments that can be accepted as arrays. |
prepareArguments() (opens new window) | Prepare arguments for use, converting to array where applicable. |
prepareQuery() | Prepare an element Query based on the source, arguments and the field name on the source. |
resolve() (opens new window) | Resolve a field to its value. |
resolveCount() (opens new window) | Resolve an element query to a total count of elements. |
resolveOne() (opens new window) | Resolve an element query to a single result. |
# 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
(null (opens new window)) – Field name to resolve on the source, if not a top-level resolution.
Returns
mixed
# Protected Methods
Method | Description |
---|---|
extractEagerLoadCondition() (opens new window) | Extract eager load conditions for a given resolve information. Preferably at the very top of the query. |
prepareElementQuery() (opens new window) | Prepare an element query for given resolution argument set. |