I need something like this:
$products = Products::getTable()->find(274);
foreach ($products->Categories->orderBy('title') as $category)
{
echo "{$category->title}<br />";
}
I know is it not possible, but... How can I do something like this without creating a Doctrine_Query?
Thanks.
You might add a sort function to Colletion.php :
Sorting a Doctrine_Collection of users by their age would look like this:
You could use collection iterator:
If you want to sort collection using __toString method, it will be much easier:
I was just looking at the same problem. You need to convert the Doctrine_Collection into an array:
Then you can create a custom sort function and call it:
Where compareChildren looks something like:
You can also do:
In your schema file it looks like: