Gql ​
- Type
- Class
- Namespace
- craft\helpers
- Inherits
- craft\helpers\Gql
- Since
- 3.3.0
Class Gql
Public Methods ​
Method | Description |
---|---|
applyDirectives() | Apply directives (if any) to a resolved value according to source and resolve info. |
canMutateAssets() | Return true if active schema can mutate assets. |
canMutateCategories() | Return true if active schema can mutate categories. |
canMutateEntries() | Return true if active schema can mutate entries. |
canMutateGlobalSets() | Return true if active schema can mutate global sets. |
canMutateTags() | Return true if active schema can mutate tags. |
canQueryAssets() | Return true if active schema can query assets. |
canQueryCategories() | Return true if active schema can query categories. |
canQueryDrafts() | Return true if active schema can query for drafts. |
canQueryEntries() | Return true if active schema can query entries. |
canQueryGlobalSets() | Return true if active schema can query global sets. |
canQueryInactiveElements() | Return true if active schema can query for inactive elements. |
canQueryRevisions() | Return true if active schema can query for revisions. |
canQueryTags() | Return true if active schema can query tags. |
canQueryUsers() | Return true if active schema can query users. |
canSchema() | Returns whether the given component is included in a schema, for the given action. |
createFullAccessSchema() | Creates a temporary schema with full access to the GraphQL API. |
eagerLoadComplexity() | Shorthand for returning the complexity function for an eager-loaded field. |
extractAllowedEntitiesFromSchema() | Extracts all the allowed entities from a schema for the given action. |
extractEntityAllowedActions() | Return a list of all the actions the current schema is allowed for a given entity. |
getFieldNameWithAlias() | Looking at the resolve information and the source queried, return the field name or it's alias, if used. |
getUnionType() | Get (and create if needed) a union type by name, included types and a resolver function. |
isSchemaAwareOf() | Returns whether the given component(s) are included in a schema’s scope. |
nPlus1Complexity() | Shorthand for returning the complexity function for a field that will generate a single query for every iteration. |
prepareTransformArguments() | Prepare arguments intended for asset transforms. |
relatedArgumentComplexity() | Shorthand for returning the complexity function for a field that will add a single query to execution. |
singleQueryComplexity() | Shorthand for returning the complexity function for a field that will add a single query to execution. |
wrapInNonNull() | Wrap a GQL object type in a NonNull type. |
applyDirectives()
​
Apply directives (if any) to a resolved value according to source and resolve info.
Arguments ​
$source
(mixed
)$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
)$value
(mixed
)
Returns ​
mixed
canMutateAssets()
​
- Since
- 3.5.0
Return true if active schema can mutate assets.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canMutateCategories()
​
- Since
- 3.5.0
Return true if active schema can mutate categories.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canMutateEntries()
​
- Since
- 3.5.0
Return true if active schema can mutate entries.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canMutateGlobalSets()
​
- Since
- 3.5.0
Return true if active schema can mutate global sets.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canMutateTags()
​
- Since
- 3.5.0
Return true if active schema can mutate tags.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryAssets()
​
Return true if active schema can query assets.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryCategories()
​
Return true if active schema can query categories.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryDrafts()
​
- Since
- 3.6.8
Return true if active schema can query for drafts.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryEntries()
​
Return true if active schema can query entries.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryGlobalSets()
​
Return true if active schema can query global sets.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryInactiveElements()
​
- Since
- 3.6.8
Return true if active schema can query for inactive elements.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryRevisions()
​
- Since
- 3.6.8
Return true if active schema can query for revisions.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryTags()
​
Return true if active schema can query tags.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canQueryUsers()
​
Return true if active schema can query users.
Arguments ​
$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
canSchema()
​
Returns whether the given component is included in a schema, for the given action.
Arguments ​
$component
(string) – The component to check.$action
(string) – The action. Defaults to "read".$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
Throws ​
createFullAccessSchema()
​
- Since
- 3.4.0
Creates a temporary schema with full access to the GraphQL API.
Returns ​
eagerLoadComplexity()
​
- Since
- 3.6.0
Shorthand for returning the complexity function for an eager-loaded field.
Returns ​
extractAllowedEntitiesFromSchema()
​
Extracts all the allowed entities from a schema for the given action.
Arguments ​
$action
(string) – The action for which the entities should be extracted. Defaults to "read".$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
extractEntityAllowedActions()
​
Return a list of all the actions the current schema is allowed for a given entity.
Arguments ​
$entity
(string)$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
getFieldNameWithAlias()
​
Looking at the resolve information and the source queried, return the field name or it's alias, if used.
Arguments ​
$resolveInfo
(\GraphQL\Type\Definition\ResolveInfo
)$source
(mixed
)$context
(mixed
)
Returns ​
getUnionType()
​
Get (and create if needed) a union type by name, included types and a resolver function.
Arguments ​
$typeName
(string) – The union type name.$includedTypes
(array) – The type the union should include$resolveFunction
(callable) – The resolver function to use to resolve a specific type.
Returns ​
mixed
isSchemaAwareOf()
​
Returns whether the given component(s) are included in a schema’s scope.
Arguments ​
$components
(string, string[]) – The component(s) to check.$schema
(craft\models\GqlSchema, null) – The GraphQL schema. If none is provided, the active schema will be used.
Returns ​
nPlus1Complexity()
​
- Since
- 3.6.0
Shorthand for returning the complexity function for a field that will generate a single query for every iteration.
Returns ​
prepareTransformArguments()
​
- Since
- 3.5.3
Prepare arguments intended for asset transforms.
Arguments ​
$arguments
(array)
Returns ​
relatedArgumentComplexity()
​
- Since
- 3.6.7
Shorthand for returning the complexity function for a field that will add a single query to execution.
Arguments ​
$baseComplexity
(integer) – The base complexity to use. Defaults to a single query.
Returns ​
singleQueryComplexity()
​
- Since
- 3.6.0
Shorthand for returning the complexity function for a field that will add a single query to execution.
Returns ​
wrapInNonNull()
​
Wrap a GQL object type in a NonNull type.
Arguments ​
$type
(mixed
)
Returns ​
mixed