Re: Tree removing nodes

From: Date: Tue, 20 May 2003 08:56:44 +0000
Subject: Re: Tree removing nodes
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-5451@lists.php.net to get a copy of this message
i am not sure if i understand what you mean, but why dont you just write your own remove() method which checks $tree->hasChildren($nodeIdToRemove) before removing? hth Wolfram Joseph Blythe wrote:
Hey all, Is there a way to just remove one node at a time ? I don't mind if a node and all it children get deleted but this really isnt the best situation when its a root node (parentId = 0) For example consider the situation below id's 1-5 are root nodes 6-8 are children of id 1 if I remvoved id one 1 -5 are also removed ? id Parent name 1 0 One 2 0 Two 3 0 Three 4 0 Four 5 0 Five 6 1 Six 7 1 Seven 8 1 Eight --snip $options = array( 'table' => 'categories', 'whereAddOn' => 'user_id=0'); $tree = Tree::setup('Dynamic_DBnested', $dsn, $options); $node = $tree->remove($_GET['id']); if (PEAR::isError($node)) { echo "Error deleting node: " . $node->getUserInfo(); } snip-- Anyone suggest a way to get out of this I tried the _remove() method nothing happens ? Any help appreciated, Joseph Blythe
-- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... translating template engine .... http://sf.net/projects/simpletpl ... authentication system .... http://sf.net/projects/auth

« previous php.pear.general (#5451) next »