Data Producers
Add the field to the schema
type Article {
id: Int!
title: String!
author: String
}Add the resolver
// Initialize builder which is used to build the resolving logic for the
// fields. This includes the output data which is going to be produced,
// the inputs required for resolving them (resolver arguments, other static
// or dynamic values, or even values produced by parent resolver), then the
// contexts which the resolver can be aware of (eg language), and other
// essentials.
$builder = new ResolverBuilder();
$registry->addFieldResolver('Article', 'author',
$builder->compose(
$builder->produce('entity_owner')
->map('entity', $builder->fromParent()),
$builder->produce('entity_label')
->map('entity', $builder->fromParent())
)
);Resolver builder
Notes
Last updated
Was this helpful?