Does Phalcon\Paginator\Adapter\Model not support MongoDB collections?

Hi,

I have the following code:

use Phalcon\Paginator\Adapter\Model as Paginator;

// ...

$result = MyCollection::find();

$paginator = new Paginator(array(
    "data" => $result,
    "limit"=> 25,
    "page" => $numberPage,
));

$this->view->page = $paginator->getPaginate();

I thought it would have been neat if this class could handle mutliple types (and in my view I'd still have $page->total_pages, $page->current, $page->before etc). Or, do I neeed to create my own Paginator to handle these dataset?



3.5k

You can check our vegas-cmf/core Mongo adapter for Pagination: https://github.com/vegas-cmf/core/blob/master/src/Paginator/Adapter/Mongo.php Cheers!