Once a referenced not gets deleted, the edit form field on the referenced node gets trashed.
I think the "normal" thing to do is delete all references to that deleted node.
I have a bare idea of how to do it but dont have the in-deep knowledge on CCK to make it.
My pseudo-php-code looks like:
function nodereference_nodeapi($node, $op) {
switch ($op) {
case 'delete':
foreach( nodereferences fields as $field) {
if ($field->stored_as_table) {
sql(delete from $field->table where $field->referencednode_nid=$node->nid);
} else {
sql(update $field->table set $field->referencednode_nid=null where $field->referencednode_nid=$node->nid;
}
}
}
}
I guess there is much more to do (update/clear caches, update reference values indexes,...)
Comments
Comment #1
dman commentedHere's one for my needs.
This still seems to be an issue in the latest (5) checkout today.
In the patch here I also added a thing to stop dead links show up when editing the original pointer. In theory you won't need both these fixes at the same time ... but choose which repair-job approach you prefer.
Comment #2
dman commentedI did attach the patch, really!
Comment #3
ali27 commentedi resouled the problem by this code in content.module from line 446 to 510
Comment #4
electricmonk commentedDid this issue get incorporated into CCK for D5 or D6? I find it to be extremely critical
Comment #5
catorghans commentedI need this too for D5. is the code from #3 tested already?
Comment #6
markus_petrux commentedThis is the oldest issue I've found on the subject: #83929: referential integrity
Comment #7
socialnicheguru commentedI think this is causing major issues on my test server