简体   繁体   English

Zend_Db_Table关系和Zend_Paginator

[英]Zend_Db_Table Relationships and Zend_Paginator

is there a way, hot to apply paginator limit on select, which I send to findDependentRowset function? 有没有办法,热选择应用paginator限制,我发送到findDependentRowset函数? 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. 您只需要为传递给findDependentRowset的select添加限制。 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. 这看起来不错,但是paginator将没有关于所有行数的信息。 I found solution to override Zend_Paginator_Adapter_DbSelect and set function 我找到了覆盖Zend_Paginator_Adapter_DbSelect和设置函数的解决方案

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 这将返回带有应用限制的选择,我可以使用Paginator及其整个功能

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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