Php Symfony原则嵌套设置根查询的路径

Php Symfony原则嵌套设置根查询的路径,php,symfony1,doctrine,nested-sets,Php,Symfony1,Doctrine,Nested Sets,在symfony中有没有一种方法可以从条令嵌套集获取从id指定元素到条令集合或数组中根元素的整个路径/路由?我认为这应该返回您想要的: $obj->getNode()->getAncestors(); 从中,如果您正在考虑构建类似面包屑路径的东西,getPath将这样做: getPath public string getPath(string seperator, mixed includeRecord, bool includeNode) gets path to node

在symfony中有没有一种方法可以从条令嵌套集获取从id指定元素到条令集合或数组中根元素的整个路径/路由?

我认为这应该返回您想要的:

$obj->getNode()->getAncestors();

中,如果您正在考虑构建类似面包屑路径的东西,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

因此,您需要在模型中重写_toString()。如果你不这样做,信条会试图通过查找名为“姓名”、“标题”之类的专栏来猜测该写什么