Search code examples
phpcakephpcakephp-2.8

CakePHP: is there a way to make every find('list') return an array ordered?


I'd like every Model->find('list') could return the array ordered by the $displayField set on Model. Is there a way to do this beyond set 'order' => 'Model.display_field ASC' on every find call?


Solution

  • Yes, just set $order in the model.

    http://book.cakephp.org/2.0/en/models/model-attributes.html#order