ZF-4207: Zend_Paginator should only force adapter results to implement Traversable

Issue Type: Patch Created: 2008-09-05T12:00:16.000+0000 Last Updated: 2008-09-05T21:07:11.000+0000 Status: Resolved Fix version(s): - 1.6.1 (15/Sep/08)

Reporter: Jason Eisenmenger (jasoneisen) Assignee: Matthew Ratzloff (mratzloff) Tags: - Zend_Paginator

Related issues: Attachments: - Zend_Paginator.diff


Here is the current method:

<pre class="highlight">
    public function getItemsByPage($pageNumber)
        $pageNumber = $this->normalizePageNumber($pageNumber);
        if (isset($this->_pageItems[$pageNumber])) {
            return $this->_pageItems[$pageNumber];
        $offset = ($pageNumber - 1) * $this->_itemCountPerPage;
        $items = $this->_adapter->getItems($offset, $this->_itemCountPerPage);
        if (!$items instanceof Iterator) {
            $items = new ArrayIterator($items);
        $this->_pageItems[$pageNumber] = $items;
        return $items;

Nowhere in the Zend_Paginator namespace are any iterator methods used, so forcing it is a bit harsh. It also blocks out the options of an ArrayObject being returned.

Setting this to Traversable would be a better option.


Posted by Matthew Ratzloff (mratzloff) on 2008-09-05T21:07:08.000+0000

Fixed in revision 11242.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.