ZF-11777: Zend_Paginator_Adapter_Interface - getItems()'s param

Issue Type: Improvement Created: 2011-09-29T14:22:31.000+0000 Last Updated: 2011-09-29T14:30:51.000+0000 Status: Open Fix version(s): Reporter: Mizuki Yamanaka (charlesvineyard) Assignee: Jurrien Stutterheim (norm2782) Tags: - Zend_Paginator

Related issues: Attachments:


Zend_Paginator_Adapter_Interface - getItems()'s param is $offset and $itemCountPerPage. I suggest not $offset but $page. Certainly we have $page because that time is paginator controlling. $offset is little hard to use.

Now we must write ...example

<pre class="highlight">
$offset = ($page - 1) * $itemCountPerPage;
$items = $paginator->getAdapter()->getItems($offset, $itemCountPerPage);

I want to ...

<pre class="highlight">
$items = $paginator->getAdapter()->getItems($page, $itemCountPerPage);

And that needs the modifications, for example in Zend_Paginator_Adapter_DbSelect,

<pre class="highlight">
// Before
public function getItems($offset, $itemCountPerPage)
    $this->_select->limit($itemCountPerPage, $offset);
    return $this->_select->query()->fetchAll();

<pre class="highlight">
// After
public function getItems($page, $itemCountPerPage)
    $this->_select->limitPage($page, $itemCountPerPage);
    return $this->_select->query()->fetchAll();

In other Adapter classes will be required same effect modification.

Is this a good idea for patche? If you know other simple way, please tell me.


No comments to display

Have you found an issue?

See the Overview section for more details.


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

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