I need something like this:
$products = Products::getTable()->find(274);
foreach ($products->Categories->orderBy(\'title\') as $category
I was just looking at the same problem. You need to convert the Doctrine_Collection into an array:
$someDbObject = Doctrine_Query::create()...;
$children = $someDbObject->Children;
$children = $children->getData(); // convert from Doctrine_Collection to array
Then you can create a custom sort function and call it:
// sort children
usort($children, array(__CLASS__, 'compareChildren')); // fixed __CLASS__
Where compareChildren looks something like:
private static function compareChildren($a, $b) {
// in this case "label" is the name of the database column
return strcmp($a->label, $b->label);
}