Ver código fonte

Delete removed entity from chado_bio_data_x

Abdullah Almsaeed 6 anos atrás
pai
commit
812ad259cb
1 arquivos alterados com 6 adições e 2 exclusões
  1. 6 2
      tripal_chado/includes/tripal_chado.entity.inc

+ 6 - 2
tripal_chado/includes/tripal_chado.entity.inc

@@ -142,9 +142,13 @@ function tripal_chado_entity_update($entity, $type) {
  * Implements hook_entity_delete().
  */
 function tripal_chado_entity_delete($entity, $type) {
-  if ($type == 'TripalEntity') {
-
+  if ($type !== 'TripalEntity') {
+    return;
   }
+
+  // Delete the removed entity from the corresponding chado_bio_data_x table
+  $bundle = $entity->bundle;
+  db_delete("chado_{$bundle}")->condition('entity_id', $entity->id);
 }
 
 /**