<?php
require_once('vendor/autoload.php');
/* Start to develop here. Best regards https://php-download.com/ */
vasily-kartashov / graphql-batch-processor example snippets
// Name of the cache is `addressesByUserId`
return Batch::as('addressesByUserId')
// Collect user IDs
->collectOne($user->id())
// When all user IDs are collected, fetch addresses for all collected user IDs
// The callback is only executed once for each set of user IDs
// And cached internally under the name `addressesByUserId`
->fetchOneToMany(function (array $userIds) {
return $this->addressRepository->findAddressesByUserIds($userIds);
});