Skip to content

Commit c895671

Browse files
Fixing Cloud Queues iterator for messages (which had strict limits)
1 parent 4487244 commit c895671

File tree

2 files changed

+25
-3
lines changed

2 files changed

+25
-3
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
<?php
2+
3+
namespace OpenCloud\Queues\Collection;
4+
5+
use OpenCloud\Common\Collection\PaginatedIterator;
6+
7+
class QueuesIterator extends PaginatedIterator
8+
{
9+
10+
11+
12+
}

lib/OpenCloud/Queues/Resource/Queue.php

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,12 @@ public function createMessages(array $messages)
244244
$parts = array_merge($this->getUrl()->getParts(), parse_url($location));
245245
$url = Url::factory(Url::buildUrl($parts));
246246

247-
return $this->getService()->resourceList('Message', $url, $this);
247+
$options = $this->makeResourceIteratorOptions(__NAMESPACE__ . '\\Message') + array(
248+
'baseUrl' => $url,
249+
'limit.page' => 10
250+
);
251+
252+
return PaginatedIterator::factory($this, $options);
248253
}
249254

250255
return true;
@@ -284,9 +289,14 @@ public function listMessages(array $options = array())
284289
$options['ids'] = implode(',', $options['ids']);
285290
}
286291

287-
$url = $this->url('messages', $options);
292+
$url = $this->getUrl('messages', $options);
293+
294+
$options = $this->makeResourceIteratorOptions(__NAMESPACE__ . '\\Message') + array(
295+
'baseUrl' => $url,
296+
'limit.page' => 10
297+
);
288298

289-
return $this->getService()->resourceList('Message', $url, $this);
299+
return PaginatedIterator::factory($this, $options);
290300
}
291301

292302
/**

0 commit comments

Comments
 (0)