Posted by sami_k on March 6, 2006 at 8:40pm
Jump to:
| Project: | Clipper |
| Version: | master |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
Issue Summary
Deleting a child deletes all childrens from a parent node.
Comments
#1
It seems that the code tries to make stuff a lot more robust than it need be:
<?php
/**
* NodeAPI: called when a node is updated. This is just a wrapper around
* clipper_insert, with an extra deletion of parent relationships for $node.
*/
function clipper_update($node) {
db_query("DELETE FROM {relations} WHERE (right_id = %d AND relationship = 'parent-child')", $node->nid);
if ($node->clipper_parent) {
clipper_insert($node);
}
}
/**
* NodeAPI: called whenever a node is deleted.
*/
function clipper_delete($node) {
if ($node->clipper->parents) {
foreach ($node->clipper->parents as $parent) {
db_query("DELETE FROM {relations} WHERE (left_id = %d AND right_id = %d AND relationship = 'parent-child')", $parent, $node->nid);
}
}
}
?>
#2
I think I agree with Allie Micka on the fact that the old clipper module was quite useful and to some extend I am tempted to replicate it and call it a heirarchy clipper module which only allows for clipping a child to a parent so [1:m] relationships... that seems a lot more useful to me ATM... this obviously just being IMO and not being an argument against this work... it's just a lot more complicated, for my purposes, than it need be...
#3
I do not understand the last comment. Why is it too robust? What is the bug, how can I reproduce it, and why should we change or roll back anything. Please be verbose.
#4
Create a parent, then create many children. Now go and delete one of the children. I believe that should do it, let me know if it doesn't. The deletion queries to me seem like they're deleting things that this module doesn't yet create, looking at the insert queries.
#5
CAn someone who experiences this bug try to create a patch?