Shanty-Mongo和Zend_Paginator

时间:2011-11-15 01:09:37

标签: zend-framework mongodb

有人知道如何将Shanty-Mongo适配器与Zend Pagination集成吗?

https://github.com/coen-hyde/Shanty-Mongo

这是我在下一页上找到的片段,但不知道$ cursor变量引用了什么:

$adapter = new Shanty_Paginator_Adapter_Mongo(Shanty_Mongo_Iterator_Cursor $cursor);
$paginator = new Zend_Paginator($adapter);

https://github.com/coen-hyde/Shanty-Mongo/pull/18

1 个答案:

答案 0 :(得分:1)

计算解决方案。这是我的查询示例......

        $cursor = Model_Mongo_Locations::all();

        $adapter = new Shanty_Paginator_Adapter_Mongo($cursor);
        $paginator = new Zend_Paginator($adapter);

        $page = $this->getRequest()->getParam('page');
        $page = $filter->filter($page);

        $paginator->setCurrentPageNumber($page);
        $paginator->setItemCountPerPage(6);
        $paginator->setPageRange(5);