Open
Description
Hi to all,
I'm having big troubles to make Entity Load Multiple work.
I did a custom resolver to filter the ids I need to load (it works)
I load entities from those ids (it works, looking with XDebug I see an array with the entities loaded)
I try to give them to the "sub-type" for seeing them on the response but nothing happens.
Response is always empty.
Trying with XDebug, I see that it never goes to "Percorso". It's like if I'm missing something to "connect" the result of the first resolver to the one who has to resolve "Percorso".
My graphqls
type AllPercorsi {
percorsi: [Percorso]
}
type Percorso {
id: Int!
title: String!
}
type PercorsiResponse implements Response {
errors: [Violation]
percorsi: AllPercorsi
}
My Schema
$builder = new ResolverBuilder();
$registry->addFieldResolver('Query', 'percorsi',
$builder->compose(
$builder->produce('get_percorsi'),
$builder->produce('entity_load_multiple')
->map('type', $builder->fromValue('node'))
->map('bundles', $builder->fromValue(['percorso']))
->map('ids', $builder->fromParent())
)
);
$registry->addFieldResolver('PercorsiResponse', 'percorsi',
$builder->callback(function (PercorsiResponse $response) {
return $response->percorsi();
})
);
$registry->addFieldResolver('PercorsiResponse', 'errors',
$builder->callback(function (PercorsiResponse $response) {
return $response->getViolations();
})
);
/**
* PERCORSO
*/
$registry->addFieldResolver('Percorso', 'id',
$builder->produce('entity_id')
->map('entity', $builder->fromParent())
);
$registry->addFieldResolver('Percorso', 'title',
$builder->compose(
$builder->produce('entity_label')
->map('entity', $builder->fromParent())
)
);
Thanks to anyone... I did not find anything on the web, or in the documentation.