aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/relationships.php
diff options
context:
space:
mode:
Diffstat (limited to 'engine/lib/relationships.php')
-rw-r--r--engine/lib/relationships.php16
1 files changed, 11 insertions, 5 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index 28c7ba604..519f28566 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -346,21 +346,27 @@
* 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 string $relationship The name of the relationship (optionally)
* @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) {
+ function remove_entity_relationships($guid_one, $relationship = "", $inverse = false) {
global $CONFIG;
$guid_one = (int) $guid_one;
- $relationship = sanitise_string($relationship);
+
+ if (!empty($relationship)) {
+ $relationship = sanitise_string($relationship);
+ $where = "and relationship='$relationship'";
+ } else {
+ $where = "";
+ }
if (!$inverse) {
- return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one and relationship='$relationship'");
+ return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid_one {$where}");
} else {
- return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_two=$guid_one and relationship='$relationship'");
+ return delete_data("DELETE from {$CONFIG->dbprefix}entity_relationships where guid_two=$guid_one {$where}");
}
}