[DC-403] Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible Created: 06/Jan/10  Updated: 16/Apr/10

Status: Open
Project: Doctrine 1
Component/s: Nested Set
Affects Version/s: 1.2.1
Fix Version/s: 1.2.0

Type: Improvement Priority: Major
Reporter: alex Assignee: Jonathan H. Wage
Resolution: Unresolved Votes: 2
Labels: None


 Description   

How to reproduce

  1. fetch a tree with nested set
    $root = Doctrine::getTable($model)->getTree()->findRoot($rootId);
    $treeObject= Doctrine::getTable($model)->getTree()->fetchTree($root->getId()); 
    
  2. issue
    $root->getNode()->getChildren();
    
    or there will be a total query mess in a lambda function with a loop getChildren().
    ...
    <?php foreach($root->getChildren() as $child): ?>
       ....
    <?php endforeach; ?>
    ...
    
    

Problem is described more verbosely here – http://codeutopia.net/blog/2008/08/30/understanding-doctrines-nestedset-feature/

What behavior is expected

An already fetched record instance is returned, without calling database and without causing query flooding.

Like in propel.

In propel if you are calling ....::retrieveTree($id) it returns the root
with completed, pooled (cached) and linked tree.

What happens

An additional query is issued

This is a big slip in architecture of Doctrine`s nested set implementation.


Generated at Thu Dec 18 09:41:20 UTC 2014 using JIRA 6.2.3#6260-sha1:63ef1d6dac3f4f4d7db4c1effd405ba38ccdc558.