avasin avasin - 9 months ago 42
PHP Question

Is it possible to specify two limit values(from, offset) in one Phalcon\Mvc\Model::find() method?

For a moment i found following example:

$robots = Robots::find(array("limit" => 100));

Is it possible to define two values for limit, "from" and "offset"?
In Zend Framework it was possible with Db adapter function, that looked like this:

$db->select()->limit($from, $offset)


You could always use PHQL which supports the OFFSET like so (in a controller):

$sql     = 'SELECT * FROM Robots LIMIT 100 OFFSET 10';
$stmt    = $this->modelsManager->createQuery($sql)
$results = $stmt->execute();