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

Description

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


$offset = ($page - 1) * $itemCountPerPage;
$items = $paginator->getAdapter()->getItems($offset, $itemCountPerPage);

I want to ...


$items = $paginator->getAdapter()->getItems($page, $itemCountPerPage);

And that needs the modifications, for example in Zend_Paginator_Adapter_DbSelect,


// Before
public function getItems($offset, $itemCountPerPage)
{
    $this->_select->limit($itemCountPerPage, $offset);
    return $this->_select->query()->fetchAll();
}

// 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.

Comments

No comments to display