Doctrine 1
  1. Doctrine 1
  2. DC-403

Eliminate queries produced by Doctrine_Node_NestedSet::getDescendants() when possible

    Details

    • Type: Improvement Improvement
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.1
    • Fix Version/s: 1.2.0
    • Component/s: Nested Set
    • 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.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            alex
          • Votes:
            2 Vote for this issue
            Watchers:
            1 Start watching this issue

            Dates

            • Created:
              Updated: