Details
-
Type:
Bug
-
Status:
Open
-
Priority:
Major
-
Resolution: Unresolved
-
Affects Version/s: 1.2.2
-
Fix Version/s: None
-
Component/s: Nested Set
-
Labels:None
-
Environment:HidePHP 5.3.2 (cli) (built: Apr 12 2010 15:44:21)
Copyright (c) 1997-2010 The PHP Group
Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies
with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies
- with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled]
- with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled]
- with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [enabled]
MySQL
* Server: Localhost via UNIX socket
* Server version: 5.1.41-3ubuntu12.1
* Protocol version: 10ShowPHP 5.3.2 (cli) (built: Apr 12 2010 15:44:21) Copyright (c) 1997-2010 The PHP Group Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies with Zend Extension Manager v5.1, Copyright (c) 2003-2010, by Zend Technologies - with Zend Data Cache v4.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [disabled] - with Zend Utils v1.0, Copyright (c) 2004-2010, by Zend Technologies [loaded] [licensed] [enabled] - with Zend Optimizer+ v4.1, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [disabled] - with Zend Debugger v5.3, Copyright (c) 1999-2010, by Zend Technologies [loaded] [licensed] [enabled] MySQL * Server: Localhost via UNIX socket * Server version: 5.1.41-3ubuntu12.1 * Protocol version: 10
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 !