views:

71

answers:

1

Is there a straightforward (easy) way to use Zend Framework's Paginator with the Zend Framework Amazon service? It looks like the recordset returned by the Amazon service is not what the Paginator needs.

A: 

I haven't been able to test this I'm afraid, but the docs for Zend_Service_Amazon state that the result set implements SeekableIterator ( http://framework.zend.com/manual/en/zend.service.amazon.html#zend.service.amazon.classes.resultset ) - and that should be compatible with the Iterator adapter for Zend_Paginator, e.g.:

$amazon = new Zend_Service_Amazon(....);
$results = $amazon->itemSearch(array('SearchIndex' => 'Books', 'Keywords' => 'php'));
$paginator = new Zend_Paginator(new Zend_Paginator_Adapter_Iterator($results));
Will Prescott