We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

Question on the request in the construction of the pagination

$users = Users::find(array(
            "order" => "id"
));
$paginator = new \Phalcon\Paginator\Adapter\Model(
            array(
                "data" => $users,
                "limit"=> 10,
                "page" => $currentPage
            )
        );

A query of the form:

```sql
SELECT `users`.`id`, `users`.`role`, `users`.`firstname`, `users`.`lastname`, `users`.`email`, `users`.`birthday`, `users`.`sex`, `users`.`username`, `users`.`password`, `users`.`logins`, `users`.`last_login` FROM `users` ORDER BY `users`.`id`

That is no limit to automatically request does not exhibit. Do I need to put in your hand limit? If I have 100,000 users in the database...



11.9k
edited Mar '14
$builder = $this->modelsManager->createBuilder()
            ->from('Phcms\Common\Models\Users')
            ->orderBy('id');

        $paginator = new \Phalcon\Paginator\Adapter\QueryBuilder(array(
            "builder" => $builder,
            "limit"=> 10,
            "page" => 1
        ));

:((

You may use "edit" function of the forum... ;)

All is there : https://docs.phalcon.io/en/latest/reference/pagination.html

Limit means, how much user you want per page. Then if you have 100 000 users in your DB you will have 10 000 pages