DB_NestedSet not updating parent id properly
| From: | Andy Crain | Date: | Tue, 18 Nov 2003 00:26:59 +0000 |
| Subject: | DB_NestedSet not updating parent id properly | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-23719@lists.php.net to get a copy of this message | ||
Daniel,
I think this might be a small bug. Please let me know if I'm wrong.
NestedSet fails to update the parent id for a node when the node is
moved-i.e. when calling moveTree(). This will occur only for those who have
and pass a parameter for a parent field in their nodes table. Currently the
node, once moved, retains its former parent id value, while it should take
on the parent id of its new parent node.
Changing line 188 from:
var $_requiredParams = array('id', 'rootid', 'l', 'r',
'norder',
'level');
to:
var $_requiredParams = array('id', 'rootid', 'l', 'r',
'norder',
'level', 'parent');
resolves the problem, which crops up because of lines 1781-1799:
if ($source[$val] && !in_array($val, $this->_requiredParams)) {
.
$clone_id = $this->create[Left | Right | Sub]Node($target['id'], $values);
I think-but haven't tested this-that line 188 currently will also cause
problems for _verifyUserValues().
Regards,
Andy