Composing producers
$registry->addFieldResolver('Query', 'currentUser', $builder->compose(
$builder->produce('current_user'),
$builder->produce('entity_load')
->map('type', $builder->fromValue('user'))
->map('id', $builder->fromParent())
));Custom steps
$registry->addFieldResolver('Query', 'currentUser', $builder->compose(
$builder->produce('current_user'),
$builder->produce('entity_load')
->map('type', $builder->fromValue('user'))
->map('id', $builder->fromParent()),
$builder->callback(function ($entity) {
// Here we can do anything we want to the data. We get as a parameter anything that was returned
// in the previous step.
})
));Debugging producers
Last updated
Was this helpful?