I have the following code :
$treeObject = Doctrine_Core::getTable('Category')->getTree();
$rootColumnName = $treeObject->getAttribute('rootColumnName');
foreach ($treeObject->fetchRoots() as $root) {
$options = array( 'root_id' => $root->$rootColumnName );
foreach($treeObject->fetchTree($options) as $node) {
$parent_id = $node->getNode()->getParent()->getId();
echo $parent_id;
}
}
This works fine however the getparent() call executes a query for every node. is there away to retrieve the parent id with out running hundreds of extra queries.