2010-02-23 31 views
1
Task: 
    columns: 
    name: string(100) 
    parent_id: integer 
    relations: 
    Parent: 
     class: Task 
     local: parent_id 
     foreign: id 
     foreignAlias: Subtasks 

回答

1

http://www.doctrine-project.org/documentation/manual/1_1/hu/hierarchical-data

Task: 
    actAs: [NestedSet] 
    columns: 
     name: string(100) 

你並不需要關心的父ID或任何東西,學說確實簿記你。

+0

@ Larry_Croft,我會見了'NestedSet'性能,你可以到這裏看看:HTTP://stackoverflow.com/questions/2339800/how-can-i-fetch-the-entire-tree- IN-A-單查詢與-學說 – user198729 2010-02-28 08:11:20

+0

已經寫的東西在那裏,只是發表評論那裏,如果你已經有了:-) – 2010-02-28 13:37:13

+0

一個問題,我沒有看到getBaseQuery'將如何'幫助單個查詢得到的樹結構?是否有內置的API可以在提供所有節點時構建樹? – user198729 2010-02-28 18:21:05