Possible Enhancement: Default sort and order for models

0 views
Skip to first unread message

Tony Nelson

unread,
May 24, 2011, 9:08:13 PM5/24/11
to ColdMVC
I'm thinking about adding an enhancement but wanted to get opinions
before I started work on it. I'm thinking about adding default sort
and order values for models using annotations.

For example, you might have a Product model that looks like this:

/**
* @extends coldmvc.Model
* @persistent true
* @sort name
* @order asc
*/
component {
property id;
property name;
property description;
property category;
}

Currently to list out all products and sort them by name, you'd write:

var products = _Product.list({sort="name", order="asc"});

With the @sort and @order annotations, it could simply be:

var products = _Product.list();

Thoughts? Is it worth adding, or is it just more stuff you need to
know?
Reply all
Reply to author
Forward
0 new messages