Felix
Felix

Reputation: 619

PhalconPHP find function

today my question is more about style than about programming...

I'm starting with PhalconPHP and I'm very surprised by its power, but there's a little trouble when I do use the find function to get all the results.

When I do this

$categories = Category::find('ORDER BY name DESC');

I get a mysql error about misspelling (because it assumes I want use a WHERE), so I have to do this:

$categories = Category::find('1=1 ORDER BY name DESC');

Which I consider tricky and absurd, there's a way to do what I want with no "tricks"?

Upvotes: 0

Views: 1535

Answers (1)

lafor
lafor

Reputation: 12776

You can use an array as an argument for find(), e.g.:

Category::find(array('order'=>'name DESC', 'limit'=>10));

Upvotes: 5

Related Questions