aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/entities.php')
-rw-r--r--engine/lib/entities.php14
1 files changed, 13 insertions, 1 deletions
diff --git a/engine/lib/entities.php b/engine/lib/entities.php
index 850da0008..34b73b580 100644
--- a/engine/lib/entities.php
+++ b/engine/lib/entities.php
@@ -174,6 +174,17 @@
{
return clear_metadata($this->getGUID());
}
+
+ /**
+ * Remove all entities associated with this entity
+ *
+ * @return true
+ */
+ public function clearRelationships() {
+ remove_entity_relationships($this->getGUID());
+ remove_entity_relationships($this->getGUID(),"",true);
+ return true;
+ }
/**
* Adds an annotation to an entity. By default, the type is detected automatically; however,
@@ -917,7 +928,8 @@
if (trigger_event('delete',$entity->type,$entity)) {
if ($entity->canEdit()) {
$entity->clearMetadata();
- $entity->clearAnnotations();
+ $entity->clearAnnotations();
+ $entity->clearRelationships();
$res = delete_data("DELETE from {$CONFIG->dbprefix}entities where guid={$guid}");
return $res;
}