It can be considered a bug now; please file a ticket.  I believe at the time
Paginator was released, PHP 5.0 was the minimum required version and so it
was left out because it wouldn't be widely used (that parameter was added in
5.0.2).

For now you could simply create your own adapter to get around the issue.

-Matt

On Wed, Aug 11, 2010 at 6:18 AM, damir.mitrovic <damir.mitro...@gmail.com>wrote:

>
> Hi,
>
> I am wondering is this is normal behaviour. I have an array:
>
>  array(2) {
>      [127443] => string(8) "12345678"
>      [1270236] => string(8) "12345678"
>      [1270656] => string(8) "12345678"
>    }
> I've created Zend_Paginator object with Zend_Pagination_Adapter_Array and I
> am iterating this object.
>
> When I iterate it like:
>
> foreach($paginator as $key => $value){
> echo $key;
> echo $value;
> }
>
> $key values are lost. I've checked source of the
> Zend_Pagination_Adapter_Array, function getItems():
>
> /**
>     * Returns an array of items for a page.
>     *
>     * @param  integer $offset Page offset
>     * @param  integer $itemCountPerPage Number of items per page
>     * @return array
>     */
>    public function getItems($offset, $itemCountPerPage)
>    {
>        return array_slice($this->_array, $offset, $itemCountPerPage);
>    }
>
> Function array_slice could take fourth parameter: $preserve_keys and it is
> not. So, the question is, is this behaviour per design or it is a bug?
>
> Regards,
> Damir
> --
> View this message in context:
> http://zend-framework-community.634137.n4.nabble.com/Zend-Pagination-Adapter-Array-usage-questions-tp2321181p2321181.html
> Sent from the Zend Framework mailing list archive at Nabble.com.
>

Reply via email to