createPromiseAll() публичный Метод

Given an array of promises, return a promise that is fulfilled when all the items in the array are fulfilled.
public createPromiseAll ( mixed $promisesOrValues ) : GraphQL\Executor\Promise\Promise
$promisesOrValues mixed Promises or values.
Результат GraphQL\Executor\Promise\Promise equivalent to Promise.all result
Пример #1
0
 /**
  * Complete a list value by completing each item in the list with the
  * inner type
  *
  * @param ExecutionContext $exeContext
  * @param ListOfType $returnType
  * @param $fieldNodes
  * @param ResolveInfo $info
  * @param array $path
  * @param $result
  * @return array|Promise
  * @throws \Exception
  */
 private static function completeListValue(ExecutionContext $exeContext, ListOfType $returnType, $fieldNodes, ResolveInfo $info, $path, &$result)
 {
     $itemType = $returnType->getWrappedType();
     Utils::invariant(is_array($result) || $result instanceof \Traversable, 'User Error: expected iterable, but did not find one for field ' . $info->parentType . '.' . $info->fieldName . '.');
     $containsPromise = false;
     $i = 0;
     $completedItems = [];
     foreach ($result as $item) {
         $fieldPath = $path;
         $fieldPath[] = $i++;
         $completedItem = self::completeValueCatchingError($exeContext, $itemType, $fieldNodes, $info, $fieldPath, $item);
         if (!$containsPromise && self::$promiseAdapter->isPromise($completedItem)) {
             $containsPromise = true;
         }
         $completedItems[] = $completedItem;
     }
     return $containsPromise ? self::$promiseAdapter->createPromiseAll($completedItems) : $completedItems;
 }