Issues

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

Description

Here is the current method:


    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.

Comments

Fixed in revision 11242.