Solved thread

This post is marked as solved. If you think the information contained on this thread must be part of the official documentation, please contribute submitting a pull request to its repository.

PhalconPHP bind params and oerder by

Here is the code what I've tried

$conditions = "category = :id: AND status = :status: ORDER BY :order: LIMIT 3";

$parameters = array( "id" => $cat_id, "status" => 1, "order" => "title ASC", );

$posts = Posts::find(array( $conditions, "bind" => $parameters ));

Everything is fine except order by. Can you please help me to find out the proper way to use order by in PhalconPHP?

edited Apr '15

you must define mandatory key order and limit,

$conditions = "category = :id: AND status = :status: ";
$parameters = array( "id" => $cat_id, "status" => 1 );
$posts = Posts::find(array( 
    $conditions, 
    "bind" => $parameters, 
    "order" => "order DESC", 
    "limit" => "30" 
));

In addition look here: http://docs.phalconphp.com/es/latest/reference/models.html