17 September 2010 at 2:51pm
I think I'm getting closer. They key, near as I can see it, is to write a function for the ItemCategory class that will find the ID of the parent DataObject Meal (Menu), then find the parent Page (Menu), then - from that - get the URLSegment. This is as far as I've gotten:
17 September 2010 at 3:40pm
DataObject::get will always return a DataObjectSet even if there's just one DO in it.
Given your code you could use [url=http://api.silverstripe.org/trunk/sapphire/model/DataObject.html#methodget_by_id]DataObject::get_by_id("Menu", $MealsID)[/url] or DataObject::get_one() if you wanted to add more to the query.