title: How can I fetch the entire tree in a single query with doctrine?
body: <p>This snippet from <a href="http://www.doctrine-project.org/documentation/manual/1_1/en/hierarchical-data#nested-set:rendering-with-indention" rel="nofollow noreferrer">official website</a> works as expected:</p>
  <pre><code>$treeObject = Doctrine::getTable('Category')-&gt;getTree();
  $rootColumnName = $treeObject-&gt;getAttribute('rootColumnName');
  
  foreach ($treeObject-&gt;fetchRoots() as $root) {
    $options = array(
        'root_id' =&gt; $root-&gt;$rootColumnName
    );
    foreach($treeObject-&gt;fetchTree($options) as $node) {
      echo str_repeat(' ', $node['level']) . $node['name'] . &quot;\n&quot;;
    }
  }
  </code></pre>
  <p>But I see there are dozens of queries sent to database.</p>
  <p>How can I do it in a mouthful?</p>