select order by fields value

Hi, I wonder if I could select query order by fields through builder or critiera

SELECT * FROM fruit ORDER BY FIELD(name, 'Banana', 'Apple', 'Pear', 'Orange'),



Thanks, I guess I didn't explain myself clear, I am familar with find/phql, but I want to use ORDER BY FIELD, so it always return same order I wanted. I was after something phql support with modelManager, I guess I have to use raw query to do so.


you can do quiet everything:

using ORM:

using phql (a kind of high level query language):

using query builder:

or even raw SQL:


// ORM
// Get first 100 virtual robots ordered by name
$robots = Robots::find(
        "type = 'virtual'",
        "order" => "name",
        "limit" => 100

$phql   = "SELECT * FROM Formula\Cars ORDER BY Formula\";
$query  = $manager->createQuery($phql);

// and so on