简体   繁体   中英

Zend_Db_Table Relationships and Zend_Paginator

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

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);

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM