function chado_project_delete
2.x tripal_project.chado_node.inc | chado_project_delete($node) |
3.x tripal_project.chado_node.inc | chado_project_delete($node) |
1.x tripal_project.module | chado_project_delete($node) |
Implementation of hook_delete().
Parameters
$node: The node which is to be deleted, only chado project and chado_project need to be dealt with since the drupal node is deleted automagically
Related topics
File
- tripal_project/
includes/ tripal_project.chado_node.inc, line 314 - Implement the project node content type
Code
function chado_project_delete($node) {
$project_id = chado_get_id_from_nid('project', $node->nid);
// if we don't have a project id for this node then this isn't a node of
// type chado_project or the entry in the chado_project table was lost.
if (!$project_id) {
return;
}
// Remove data from {chado_project}, {node} and {node_revisions} tables of
// drupal database
$sql_del = "DELETE FROM {chado_project} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
$sql_del = "DELETE FROM {node_revision} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
$sql_del = "DELETE FROM {node} WHERE nid = :nid AND vid = :vid";
db_query($sql_del, array(':nid' => $node->nid, ':vid' => $node->vid));
// Remove data from project and projectprop tables of chado database as well
chado_query("DELETE FROM {projectprop} WHERE project_id = :project_id", array(':project_id' => $project_id));
chado_query("DELETE FROM {project} WHERE project_id = :project_id", array(':project_id' => $project_id));
}