From b9a87412c09e1696b0b29daf47f350c72aae3440 Mon Sep 17 00:00:00 2001 From: Andreas Leathley Date: Mon, 29 Apr 2019 15:33:19 +0200 Subject: [PATCH] Add IteratorAggregate usage for SelectEntries Makes it possible to leave out the explicit getIterator call when using SelectEntries. --- src/Action/MultiSelectEntries.php | 2 +- src/Action/MultiSelectEntriesFreeform.php | 2 +- src/Action/SelectEntries.php | 2 +- src/Generate/RepositoriesGenerateCommand.php | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Action/MultiSelectEntries.php b/src/Action/MultiSelectEntries.php index 3f1206b..1759f0f 100644 --- a/src/Action/MultiSelectEntries.php +++ b/src/Action/MultiSelectEntries.php @@ -8,7 +8,7 @@ /** * Select query builder as a fluent object - build query and return entries or flattened fields */ -class MultiSelectEntries implements ActionInterface +class MultiSelectEntries implements ActionInterface, \IteratorAggregate { /** * @var MultiRepositoryReadOnlyInterface diff --git a/src/Action/MultiSelectEntriesFreeform.php b/src/Action/MultiSelectEntriesFreeform.php index b438f3b..bf4e255 100644 --- a/src/Action/MultiSelectEntriesFreeform.php +++ b/src/Action/MultiSelectEntriesFreeform.php @@ -10,7 +10,7 @@ /** * Select query builder as a fluent object - build query and return entries or flattened fields */ -class MultiSelectEntriesFreeform implements ActionInterface +class MultiSelectEntriesFreeform implements ActionInterface, \IteratorAggregate { /** * @var MultiRepositoryReadOnlyInterface diff --git a/src/Action/SelectEntries.php b/src/Action/SelectEntries.php index bcfeac3..597fa41 100644 --- a/src/Action/SelectEntries.php +++ b/src/Action/SelectEntries.php @@ -7,7 +7,7 @@ /** * Select query builder as a fluent object - build query and return object(s) or flattened fields */ -class SelectEntries implements ActionInterface +class SelectEntries implements ActionInterface, \IteratorAggregate { /** * @var RepositoryReadOnlyInterface Repository we call to execute the built query diff --git a/src/Generate/RepositoriesGenerateCommand.php b/src/Generate/RepositoriesGenerateCommand.php index 210a61b..3554173 100644 --- a/src/Generate/RepositoriesGenerateCommand.php +++ b/src/Generate/RepositoriesGenerateCommand.php @@ -75,7 +75,7 @@ public function select(): \{namespaceOfBuilders}\SelectEntries * so we instead imitate it. This way the implementation in SelectEntries can change * and this generated class has no ties to how it "works" or how the repository is used. */ - class SelectEntries implements \Squirrel\Entities\Action\ActionInterface + class SelectEntries implements \Squirrel\Entities\Action\ActionInterface, \IteratorAggregate { /** * @var \Squirrel\Entities\Action\SelectEntries