php,mysql,transitive-closure-table
Add depth+1 to the first SELECT. INSERT INTO closure_tree_path (ancestor, descendant, depth) SELECT ancestor, '{$node_id}', depth+1 FROM closure_tree_path WHERE descendant = '{$parent_id}' UNION ALL SELECT '{$node_id}', '{$node_id}', 0; ...
symfony2,doctrine2,tree,transitive-closure-table
From the doc: childrenHierarchy: This useful method allows you to build an array of nodes representing the hierarchy of a tree. Arguments: node: If you pass a node, the method will return its children. Defaults to "null" (this means it will return ALL nodes). would be something like this: //...
mysql,sorting,tree,hierarchical-data,transitive-closure-table
I would suggest splitting the node id into two concepts. One would be a unique id that is used for the graph properties (i.e. ancestor_descendant list). The second is what you show on output. 1 2 5 3 50 4 6 20 51 Then create a mapping table: Id Value...