- Issue created by @almunnings
- Merge request !45DataProducerProxy prepare() return type mixed, to accomodate Deferred arguments in producers → (Open) created by almunnings
When using a producer for a field returns a Deferred, I'm getting back a Drupal\graphql\Plugin\GraphQL\DataProducer\DataProducerProxy::prepare(): Return value must be of type GraphQL\Deferred|Drupal\graphql\Plugin\DataProducerPluginInterface, GraphQL\Executor\Promise\Adapter\SyncPromise returned
In vendor/webonyx/graphql-php/src/Executor/Promise/Adapter/SyncPromise.php
then()
has $tmp = new self();
Meaning the object is now a SyncPromise.
in web/modules/contrib/graphql/src/Plugin/GraphQL/DataProducer/DataProducerProxy.php
protected function prepare(mixed $value, array $args, ResolveContext $context, ResolveInfo $info, FieldContext $field): Deferred|DataProducerPluginInterface {
could be changed to
protected function prepare(mixed $value, array $args, ResolveContext $context, ResolveInfo $info, FieldContext $field): Deferred|SyncPromise|DataProducerPluginInterface {
to allow for then() resolution.
Active
5.0
Code