symfony中有没有办法从一个doctrine嵌套集中获取从id元素指定的整个路径/路由到Doctrine_Collection或数组中的根元素?
答案 0 :(得分:2)
答案 1 :(得分:1)
如果您正在考虑构建类似于痕迹痕迹的东西,getPath会这样做:
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
因此您需要在模型中覆盖__toString()。如果不这样做,Doctrine会尝试通过查找名为“name”,“title”等的列来猜测要写的内容。