aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/relationships.php23
1 files changed, 23 insertions, 0 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index 8e3298a61..28c7ba604 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -340,6 +340,29 @@
$guid_two = (int)$guid_two;
return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship' and guid_two=$guid_two");
+ }
+
+ /**
+ * Removes all arbitrary relationships originating from a particular entity
+ *
+ * @param int $guid_one The GUID of the entity
+ * @param string $relationship The name of the relationship
+ * @param true|false $inverse Whether we're deleting inverse relationships (default false)
+ * @return true|false Depending on success
+ */
+ function remove_entity_relationships($guid_one, $relationship, $inverse = false) {
+
+ global $CONFIG;
+
+ $guid_one = (int) $guid_one;
+ $relationship = sanitise_string($relationship);
+
+ if (!$inverse) {
+ return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship'");
+ } else {
+ return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_two=$guid_one and relationship='$relationship'");
+ }
+
}
/**