Get Child Models order by a different attribute

Hi ,

I have Parent - Children model structure.

Children model has an attribute call "sort_order".

When I call $parent->children, the list is ordered by the primary key of the Children model.

How can I order the child items by "sort_order"?

**I want to call the list of children using [size="2"]$parent->children.[/size]

[size="2"][b]

[/b][/size]

Thank you.

Chameera.

You can set the order property in your relation definition - http://www.yiiframework.com/doc/api/1.1/CBaseActiveRelation#order-detail