Search code examples
phpmysqlkohanakohana-3kohana-orm

Kohana 3: has_many and order_by


How can i order a query that uses the has_many association in Kohana 3?


Solution

  • Have you tried something like $model->items->order_by('fieldname')->find_all()? __get() method returns Query_Builder object, not a Database_Result, so you can add QBuilder's conditions (where/order_by/etc) for your needs.