Magic methods and order by

edited August 2012 in Modules
Is it possible to and an order by to a magic method?

If I have an organisations model and ues a magic method of

$this->organisations_model->find_all_by_relationship_id('1');

It would return

Array
(
[0] => Array
(
[id] => 1
[organisation_name] => Beta Company
[relationship_id] => 1
)

[1] => Array
(
[id] => 2
[organisation_name] => Alpha Company
[relationship_id] => 1
)
)

Is it possible to then order this on organisation name?

Thanks

Comments

  • edited 10:34PM
    You can't do it in the method call but you can do it via normal active record like so:
    $this->organisations_model->db()->order_by('organisation_name', 'asc'); $this->organisations_model->find_all_by_relationship_id('1');
  • edited 10:34PM
    Thanks for the reply.
Sign In or Register to comment.