tags:

views:

36

answers:

1

I'm using Kohana's ORM library, and I'm wondering if there is any way to order the results that are generated.

Example:

$priorities = ORM::factory('priority')->select_list('id','label'); //how to order these?
+4  A: 

What is select_list?

Btw, ordering in kohana is performed by order_by() method

...->order_by('field', 'asc')

More samples you can find at: http://kerkness.ca/wiki/doku.php?id=building_complex_select_statements#order_by

Also that wiki contains a lot of usefull articles about kohana: http://kerkness.ca/wiki/doku.php

zerkms
a function that must have existed an one point, but doesn't now. saw it in these docs: http://docs.kohanaphp.com/libraries/orm
GSto
which kohana version are you talking about, v2 or v3? if v3 - then there is no such function. Go to the wiki url in my answer and read about kohana v3 orm in details.
zerkms
Probably replaced by as_array('id', 'label') which returns an associative array of id => label which is perfect for handing off to a select list.
Gerry