PHP Класс GraphQL\Type\Definition\ObjectType

Almost all of the GraphQL types you define will be object types. Object types have a name, but most importantly describe their fields. Example: var AddressType = new GraphQLObjectType({ name: 'Address', fields: { street: { type: GraphQLString }, number: { type: GraphQLInt }, formatted: { type: GraphQLString, resolve(obj) { return obj.number + ' ' + obj.street } } } }); When two types need to refer to each other, or a type needs to refer to itself in a field, you can use a function expression (aka a closure or a thunk) to supply the fields lazily. Example: var PersonType = new GraphQLObjectType({ name: 'Person', fields: () => ({ name: { type: GraphQLString }, bestFriend: { type: PersonType }, }) });
Наследование: extends Type, implements OutputType, implements CompositeType
Показать файл Открыть проект Примеры использования класса

Открытые свойства

Свойство Тип Описание
$config array Keeping reference of config for late bindings and custom app-level metadata
$resolveFieldFn callable

Открытые методы

Метод Описание
__construct ( array $config ) ObjectType constructor.
getField ( string $name ) : FieldDefinition
getFields ( ) : FieldDefinition[]
getInterfaces ( ) : InterfaceType[]
implementsInterface ( InterfaceType $iface ) : boolean
isTypeOf ( $value, $context, ResolveInfo $info ) : boolean | null

Описание методов

__construct() публичный Метод

ObjectType constructor.
public __construct ( array $config )
$config array

getField() публичный Метод

public getField ( string $name ) : FieldDefinition
$name string
Результат FieldDefinition

getFields() публичный Метод

public getFields ( ) : FieldDefinition[]
Результат FieldDefinition[]

getInterfaces() публичный Метод

public getInterfaces ( ) : InterfaceType[]
Результат InterfaceType[]

implementsInterface() публичный Метод

public implementsInterface ( InterfaceType $iface ) : boolean
$iface InterfaceType
Результат boolean

isTypeOf() публичный Метод

public isTypeOf ( $value, $context, ResolveInfo $info ) : boolean | null
$value
$context
$info ResolveInfo
Результат boolean | null

Описание свойств

$config публичное свойство

Keeping reference of config for late bindings and custom app-level metadata
public array $config
Результат array

$resolveFieldFn публичное свойство

public callable $resolveFieldFn
Результат callable