diff --git a/composer.json b/composer.json index 9185afbbd..e14f6301e 100644 --- a/composer.json +++ b/composer.json @@ -61,7 +61,7 @@ }, "extra": { "branch-alias": { - "4.x-dev": "4.4.x-dev" + "4.x-dev": "4.5.x-dev" }, "expose": [ "client/images", diff --git a/src/ORM/DataList.php b/src/ORM/DataList.php index 28f538e9f..9110caabb 100644 --- a/src/ORM/DataList.php +++ b/src/ORM/DataList.php @@ -771,6 +771,20 @@ class DataList extends ViewableData implements SS_List, Filterable, Sortable, Li return $this; } + /** + * Returns a generator for this DataList + * + * @return \Generator&DataObject[] + */ + public function getGenerator() + { + $query = $this->dataQuery->query()->execute(); + + while ($row = $query->record()) { + yield $this->createDataObject($row); + } + } + public function debug() { $val = "

" . static::class . "