Is there a way in symfony to get from a doctrine nested set the whole path/route from a specified by id element to the root element in a Doctrine_Collection or array ?
2 Answers
Comments
If you're thinking of building something like a breadcrumb trail, getPath would do it:
getPath
public string getPath(string seperator, mixed includeRecord, bool includeNode)
gets path to node from root, uses record::toString() method to get node names
Parameters:
seperator - path seperator
includeNode - whether or not to include node at end of path
Returns:
string representation of path
http://www.doctrine-project.org/api/orm/1.2/doctrine/doctrine_node_nestedset.html#getPath%28%29
So you need to override __toString() in your model. If you don't, Doctrine will try to guess what to write by looking for columns called "name", "title" and the like.