Relationships of Zend_Db_Table and Zend_Paginator

Is there a hot way to apply the paginator limit on select that I send to findDependentRowset? eg:

$select = $row->select();
$select->order('item_name');    
$row->findDependentRowset($table, null, $select)

thank you's

+3
source share
2 answers

You just need to add the limit to your selection passed to findDependentRowset. It will look like this:

$select = $row->select()->limit($itemCountPerPage,$offset);
$select->order('item_name');    
$row->findDependentRowset($table, null, $select);
+1
source

it looks good, but paginator will not have information about all line counts. I found a solution to override Zend_Paginator_Adapter_DbSelect and set the function

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

this will return select with the limit applied, and I can use Paginator with all the functionality

0
source

All Articles