Re: Tree/Dynamic_DBnested (Urgent)
| From: | Wolfram Kriesing | Date: | Fri, 25 Jul 2003 06:34:33 +0000 |
| Subject: | Re: Tree/Dynamic_DBnested (Urgent) | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-6814@lists.php.net to get a copy of this message | ||
Hi Joseph,
the update method does the following first:
// jsut to be sure nothing gets screwed up :-)
unset($newValues[$this->_getColName('left')]);
unset($newValues[$this->_getColName('right')]);
unset($newValues[$this->_getColName('parentId')]);
there you can see it removes the left, right and parent-ID before updating the data in the DB. This is necessary, since updating any of these values would result in screwing up the tree, since many other rows in the db might be affected.
For changing the parent please use the method move().
Would it make sense to enhance the update() method?
regards
Wolfram
Joseph Blythe wrote:
Hello everyone, Just ran into a problem with Tree/Dynamic_DBnested was all working fine but now I can not update a node to change its parent, no errors are produced just refuses to cooperate, I beleive it may be a bug as I can manually update all the fields using phpMyAdmin, I am using Tree-0.2.4 and DB-1.4.0 example code below: snip---> $options = array( 'table' => 'categories', 'whereAddOn' => 'user_id=0', 'name' => 'name', 'parentId' => 'parent',-- Wolfram ... opensource @ vision:produktion ... http://opensource.visionp.de ... authentication system .... http://sf.net/projects/auth'order' => 'name');$tree = Tree::setup('Dynamic_DBnested', $dsn, $options); $tree->debug = 1; $rootId = $tree->update('138', array( 'name' => 'test', 'parent' => 25, 'comment' => '', 'user_id' => 0, 'image' => '', 'flag' => 1)); if (PEAR::isError($rootId)) { echo "Error updating category: " . $rootId->getUserInfo(); exit; } else { echo "Category Updated!"; } <--snip So with the code above all fields except 'parent' will update fine I don't understand why no errors are produced ?? Anyone else have any problems like this ? Any help much appreciated, Regards, Joseph