data
data copied to clipboard
Easy way to read data page by page
As an example
$query = (new Query($db))->from('customer');
$dataReader = (new QueryDataReader($query))->withSort(Sort::only(['id']));
$paginator = (new KeysetPaginator($dataReader))->withPageSize(1000);
while ($dataReader = $paginator->nextDataReader()) {
foreach ($dataReader->read() as $data) {
// work with $data
}
}
I'd name the method nextPage() or nextPageReader().
… or nextPaginator()
Should the instance returned be paginator?
No. It's can be any data reader. My idea is bad.