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...



8.8k
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 : http://docs.phalconphp.com/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