Doctrinehasstandardinterface's for managing tree's,thatareusedbyalltheimplementations.Everyrecordinthetablerepresentsanodewithinthetree(thetable),sodoctrineprovidestwointerfaces,TreeandNode.
<codetype="php">
classMenuextendsDoctrine_Record{
publicfunctionsetTableDefinition(){
$this->setTableName('menu');
// add this your table definition to set the table as NestedSet tree implementation
// $implName is 'NestedSet' or 'AdjacencyList' or 'MaterializedPath'
// $options is an assoc array of options, see implementation docs for options
$this->option('treeImpl',$implName);
$this->option('treeOptions',$options);
// you do not need to add any columns specific to the nested set implementation, these are added for you
$this->hasColumn("name","string",30);
}
// this __toString() function is used to get the name for the path, see node::getPath()