views:

625

answers:

2

Hi, is there a way, hot to apply paginator limit on select, which I send to findDependentRowset function? for example:

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

thank's

+1  A: 

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

$select = $row->select()->limit($itemCountPerPage,$offset);
$select->order('item_name');    
$row->findDependentRowset($table, null, $select);
waney
A: 

this looks good, but paginator will don't have information about all rows count. I found solution to override Zend_Paginator_Adapter_DbSelect and set function

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

this will return select with applied limit and I can use Paginator with its whole funcionality

harvejs