Doctrine 1
  1. Doctrine 1
  2. DC-707

When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...

    Details

    • Type: Bug Bug
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: 1.2.2
    • Fix Version/s: None
    • Component/s: Nested Set
    • Labels:
      None
    • Environment:

      Description

      Hi,

      When inserting node as direct children of a root node, it seems the root node is not populated with new lft/rgt values...

      Here is a test case, simply made of the code samples given in documentation :
      http://www.doctrine-project.org/projects/orm/1.2/docs/manual/hierarchical-data/en#nested-set:working-with-trees:creating-a-root-node

      /*
       * Creating a Root Node
       */
      $category = new Category();
      $category->name = 'Root Category 1';
      $category->save();
      
      $treeObject = Doctrine_Core::getTable('Category')->getTree();
      $treeObject->createRoot($category);
      
      
      /*
       * Inserting a Node
       */
      $child1 = new Category();
      $child1->name = 'Child Category 1';
      
      $child2 = new Category();
      $child2->name = 'Child Category 1';
      
      $child1->getNode()->insertAsLastChildOf($category);
      $child2->getNode()->insertAsLastChildOf($category);
      
      
      
      
      /*
       * BUGGY !
       */
      $category->getNode()->hasChildren();   // will return false, we except true as we just instert 2 children to this root node...
      
      
      $category->refresh();
      $category->getNode()->hasChildren(); // true... that's now ok !
      

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Jonathan H. Wage
            Reporter:
            Julien G
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated: