aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/entities.php
diff options
context:
space:
mode:
authorben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-21 16:25:16 +0000
committerben <ben@36083f99-b078-4883-b0ff-0f9b5a30f544>2008-05-21 16:25:16 +0000
commit1bdab3286dba42516ea49ba047943c028bbc250a (patch)
tree91206e59bc845b3b3f824db919aff7fa59a90f43 /engine/lib/entities.php
parent2725ae29f0ac3716a552717fe0965daff312dbd0 (diff)
downloadelgg-1bdab3286dba42516ea49ba047943c028bbc250a.tar.gz
elgg-1bdab3286dba42516ea49ba047943c028bbc250a.tar.bz2
Entities now clear all associated relationships on delete
git-svn-id: https://code.elgg.org/elgg/trunk@672 36083f99-b078-4883-b0ff-0f9b5a30f544
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;
}