l3pp4rd/DoctrineExtensions — Issue #196: [Tree] Retrieving a Tree in one query
Author: jcrombez
Created: 2011-11-25 09:30:04+00:00
State: open

Hello, first, big thanks for these extentsions, you can't imagine my relief when i found it a few months ago, i'm using it with Symfony 2 and stof's bundle, it's a great addition to Doctrine 2, thanks again.

I'm dealing with an simple issue though (at least i think it is :p), i can't figure how i'm supposed to deal with it, even in the documentation.

I need to go trough my tree, but when i move from a node to an other, doctrine trigger a new query :

$menuItems = $repository->childrenQuery()->getResult(); // retrieve all my nodes, but flat

$children = $menuItems[0]->getChildren();

$firstChildren = $children[0]; // trigger a query

You can imagine the crazy amount of queries i get when i'm going through a large tree. I read a couple of old related issues, but nothing really helped me so far.

I assumed the main interest of using NestedSet is to be able to retrieve an entire tree in one query, so i hope it's something possible with this implementation ? If so, how am i supposed to achieve it ?