Limit and Offset

Hey everybody,

I want to get a certain range of a resultset. I found this in the Documentation : > $drinks = \Drink::find(array( > 'limit' => array('number' => $offset, 'offset' => 5) > ));

But it returns an empty resultset ... Anybody an idea?

edited Jun '15

Hi guys,

$page =intval($app->request->get('page'));
$limit = intval($app->request->get('limit'));
$page = $page > 0 ? $page: 1 ;
$limit = $limit > 0 ? $limit : $config->constant->limit;
$offset = ($page - 1) * $limit;
$drinks = \Drink::find(array( 'limit' => array('number' => $limit, 'offset' => $start) ));

Also, this is not directly related to your issue, but with debugging these sorts of issues enabling your MySQL general log is a good way to start debugging. Either that, or logging SQL queries on your Phalcon services themselves using eventsManager.