File tree Expand file tree Collapse file tree 4 files changed +4
-108
lines changed Expand file tree Collapse file tree 4 files changed +4
-108
lines changed Original file line number Diff line number Diff line change @@ -87,33 +87,7 @@ public function getConsumedCapacity(bool $currentPageOnly = false): iterable
87
87
*/
88
88
public function getIterator (): \Traversable
89
89
{
90
- $ client = $ this ->awsClient ;
91
- if (!$ client instanceof DynamoDbClient) {
92
- throw new InvalidArgument ('missing client injected in paginated result ' );
93
- }
94
- if (!$ this ->input instanceof BatchGetItemInput) {
95
- throw new InvalidArgument ('missing last request injected in paginated result ' );
96
- }
97
- $ input = clone $ this ->input ;
98
- $ page = $ this ;
99
- while (true ) {
100
- if ($ page ->getUnprocessedKeys ()) {
101
- $ input ->setRequestItems ($ page ->getUnprocessedKeys ());
102
-
103
- $ this ->registerPrefetch ($ nextPage = $ client ->batchGetItem ($ input ));
104
- } else {
105
- $ nextPage = null ;
106
- }
107
-
108
- yield from $ page ->getConsumedCapacity (true );
109
-
110
- if (null === $ nextPage ) {
111
- break ;
112
- }
113
-
114
- $ this ->unregisterPrefetch ($ nextPage );
115
- $ page = $ nextPage ;
116
- }
90
+ yield from $ this ->getConsumedCapacity ();
117
91
}
118
92
119
93
/**
Original file line number Diff line number Diff line change @@ -34,33 +34,7 @@ class ListTablesOutput extends Result implements \IteratorAggregate
34
34
*/
35
35
public function getIterator (): \Traversable
36
36
{
37
- $ client = $ this ->awsClient ;
38
- if (!$ client instanceof DynamoDbClient) {
39
- throw new InvalidArgument ('missing client injected in paginated result ' );
40
- }
41
- if (!$ this ->input instanceof ListTablesInput) {
42
- throw new InvalidArgument ('missing last request injected in paginated result ' );
43
- }
44
- $ input = clone $ this ->input ;
45
- $ page = $ this ;
46
- while (true ) {
47
- if ($ page ->getLastEvaluatedTableName ()) {
48
- $ input ->setExclusiveStartTableName ($ page ->getLastEvaluatedTableName ());
49
-
50
- $ this ->registerPrefetch ($ nextPage = $ client ->listTables ($ input ));
51
- } else {
52
- $ nextPage = null ;
53
- }
54
-
55
- yield from $ page ->getTableNames (true );
56
-
57
- if (null === $ nextPage ) {
58
- break ;
59
- }
60
-
61
- $ this ->unregisterPrefetch ($ nextPage );
62
- $ page = $ nextPage ;
63
- }
37
+ yield from $ this ->getTableNames ();
64
38
}
65
39
66
40
public function getLastEvaluatedTableName (): ?string
Original file line number Diff line number Diff line change @@ -118,33 +118,7 @@ public function getItems(bool $currentPageOnly = false): iterable
118
118
*/
119
119
public function getIterator (): \Traversable
120
120
{
121
- $ client = $ this ->awsClient ;
122
- if (!$ client instanceof DynamoDbClient) {
123
- throw new InvalidArgument ('missing client injected in paginated result ' );
124
- }
125
- if (!$ this ->input instanceof QueryInput) {
126
- throw new InvalidArgument ('missing last request injected in paginated result ' );
127
- }
128
- $ input = clone $ this ->input ;
129
- $ page = $ this ;
130
- while (true ) {
131
- if ($ page ->getLastEvaluatedKey ()) {
132
- $ input ->setExclusiveStartKey ($ page ->getLastEvaluatedKey ());
133
-
134
- $ this ->registerPrefetch ($ nextPage = $ client ->query ($ input ));
135
- } else {
136
- $ nextPage = null ;
137
- }
138
-
139
- yield from $ page ->getItems (true );
140
-
141
- if (null === $ nextPage ) {
142
- break ;
143
- }
144
-
145
- $ this ->unregisterPrefetch ($ nextPage );
146
- $ page = $ nextPage ;
147
- }
121
+ yield from $ this ->getItems ();
148
122
}
149
123
150
124
/**
Original file line number Diff line number Diff line change @@ -118,33 +118,7 @@ public function getItems(bool $currentPageOnly = false): iterable
118
118
*/
119
119
public function getIterator (): \Traversable
120
120
{
121
- $ client = $ this ->awsClient ;
122
- if (!$ client instanceof DynamoDbClient) {
123
- throw new InvalidArgument ('missing client injected in paginated result ' );
124
- }
125
- if (!$ this ->input instanceof ScanInput) {
126
- throw new InvalidArgument ('missing last request injected in paginated result ' );
127
- }
128
- $ input = clone $ this ->input ;
129
- $ page = $ this ;
130
- while (true ) {
131
- if ($ page ->getLastEvaluatedKey ()) {
132
- $ input ->setExclusiveStartKey ($ page ->getLastEvaluatedKey ());
133
-
134
- $ this ->registerPrefetch ($ nextPage = $ client ->scan ($ input ));
135
- } else {
136
- $ nextPage = null ;
137
- }
138
-
139
- yield from $ page ->getItems (true );
140
-
141
- if (null === $ nextPage ) {
142
- break ;
143
- }
144
-
145
- $ this ->unregisterPrefetch ($ nextPage );
146
- $ page = $ nextPage ;
147
- }
121
+ yield from $ this ->getItems ();
148
122
}
149
123
150
124
/**
You can’t perform that action at this time.
0 commit comments