#1634: NestedSet: insertAsLastChildOf puts nodes in incorrect order
------------------------+---------------------------------------------------
Reporter: eXtreme | Owner: romanb
Type: defect | Status: new
Priority: blocker | Milestone: 1.0.5
Component: NestedSet | Version: 1.0.3
Resolution: | Keywords:
Has_test: 1 | Mystatus: Pending Core Response
Has_patch: 0 |
------------------------+---------------------------------------------------
Comment (by romanb):
This may simply be caused by not calling refresh() on a node between
adding several children. You need to do it as follows:
{{{
... $node is some node ...
$node2 = new Node();
$node2->insertAsLastChildOf($node);
// refresh $node before adding next child, so that in-memory tree is up-
to-date
$node->refresh();
$node3 = new Node();
$node3->insertAsLastChildOf($node);
$node4 = new Node();
$node4->insertAsLastChildOf($node3);
// refresh $node3 before adding another child, so that in-memory tree is
up-to-date
$node3->refresh();
$node5 = new Node();
$node5->insertAsLastChildOf($node3);
...
and so on
}}}
--
Ticket URL: <http://trac.phpdoctrine.org/ticket/1634#comment:3>
Doctrine <http://www.phpdoctrine.org>
PHP Doctrine Object Relational Mapper
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"doctrine-svn" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.co.uk/group/doctrine-svn?hl=en-GB
-~----------~----~----~----~------~----~------~--~---