views:

103

answers:

1
Task:
  columns:
    name: string(100)
    parent_id: integer
  relations:
    Parent:
      class: Task
      local: parent_id
      foreign: id
      foreignAlias: Subtasks
+1  A: 

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

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

You don't need to care about an parent id or anything, doctrine does the bookkeeping for you.

Larry_Croft
@Larry_Croft,I've met a performance with `NestedSet`,can you take a look here:http://stackoverflow.com/questions/2339800/how-can-i-fetch-the-entire-tree-in-a-single-query-with-doctrine
Already wrote something there, just comment there if you've got a question :-)
Larry_Croft
I don't see how `getBaseQuery` will help get the tree structure with a single query?Is there a built in API that can construct the tree when all nodes are provided?