public static function DeferredUtility::applyFinally in GraphQL 8.4
Execute a callback after a value is resolved.
Parameters
mixed $value:
callable $callback:
Return value
mixed
3 calls to DeferredUtility::applyFinally()
- DataProducerProxy::resolveCached in src/
Plugin/ GraphQL/ DataProducer/ DataProducerProxy.php - Try to return a value from cache, otherwise invoke data producer.
- DataProducerProxy::resolveUncached in src/
Plugin/ GraphQL/ DataProducer/ DataProducerProxy.php - Invoke the data producer directly.
- Server::getFieldResolver in src/
Entity/ Server.php - Returns the default field resolver.
File
- src/
GraphQL/ Utility/ DeferredUtility.php, line 43
Class
- DeferredUtility
- Helper class for dealing with deferred promises.
Namespace
Drupal\graphql\GraphQL\UtilityCode
public static function applyFinally($value, callable $callback) {
if ($value instanceof SyncPromise) {
// Recursively apply this function to deferred results.
$value
->then(function ($inner) use ($callback) {
return static::applyFinally($inner, $callback);
});
}
else {
$callback($value);
}
return $value;
}