在 symfony 中有没有办法从一个学说嵌套集合中获取从 id 元素指定的整个路径/路线到 Doctrine_Collection 或数组中的根元素?
1835 次
2 回答
2
于 2010-05-14T15:57:49.670 回答
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”等的列来猜测要写什么。
于 2010-12-15T08:51:23.463 回答