pagination problem

when i want to paginate from query builder i got an error on below

Fatal error: Phalcon\Paginator\Adapter\QueryBuilder::getPaginate() [<a href='phalcon\paginator\adapter\querybuilder.getpaginate'>phalcon\paginator\adapter\querybuilder.getpaginate</a>]: Call to undefined method limit() on class Phalcon\Mvc\Model\Resultset\Simple in C:\wamp\www\popsbuy\app\controllers\OrdersController.php on line 65

My Code:

$orders = $order->getUserOrders(); 

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

// Get the paginated results
$page = $paginator->getPaginate();


22.7k

İ solve the problem , its cuz of after createBuilder i add execute()

Thanks

Now another problem i want to learn is , when pagination is there any feature about get page numbers ?

i mean in codeigniter etc we can set the page numbers and when add it on page it is:

<<back 1 2 3 ... 8 9 10 next>>

Can i do that ?



82.7k

The paginator does not have a feature like the one you are describing.

I use this simple method in Volt:

<ul class="pager">
    {% for index in 1..page.total_pages %}
        <li>{{ link_to("/list?page=" ~ index, index) }}</li>
    {% endfor %}
</ul>
edited May '14

how to achieve pagination feature like displaying information (ex: display 5 to 10 from 100 rows). thx. I can't get totals based on conditions and limit. (in mysql: select SQLCALCFOUND_ROWS a, b from c where name like 'a%' limit 10)