aboutsummaryrefslogtreecommitdiff
path: root/engine/lib
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-29 19:11:02 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2010-01-29 19:11:02 +0000
commit63a047afd6d4538c2ace3d5eb7f8a43b838572ac (patch)
tree248c37e5dd3940a764b8519c435cccfbaf8d0341 /engine/lib
parent35c39df3d382f5e79d8833bebcfaeb4041c9c3e6 (diff)
downloadelgg-63a047afd6d4538c2ace3d5eb7f8a43b838572ac.tar.gz
elgg-63a047afd6d4538c2ace3d5eb7f8a43b838572ac.tar.bz2
Fixes #1472: get_entity_relationships() supports inverse relationships.
git-svn-id: http://code.elgg.org/elgg/trunk@3856 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib')
-rw-r--r--engine/lib/relationships.php6
1 files changed, 4 insertions, 2 deletions
diff --git a/engine/lib/relationships.php b/engine/lib/relationships.php
index d84e70bfb..c1f54472a 100644
--- a/engine/lib/relationships.php
+++ b/engine/lib/relationships.php
@@ -470,12 +470,14 @@ function remove_entity_relationships($guid_one, $relationship = "", $inverse = f
*
* @param int $guid
*/
-function get_entity_relationships($guid) {
+function get_entity_relationships($guid, $inverse_relationship = FALSE) {
global $CONFIG;
$guid = (int)$guid;
- $query = "SELECT * from {$CONFIG->dbprefix}entity_relationships where guid_one=$guid";
+ $where = ($inverse_relationship ? "guid_two='$guid'" : "guid_one='$guid'");
+
+ $query = "SELECT * from {$CONFIG->dbprefix}entity_relationships where {$where}";
return get_data($query, "row_to_elggrelationship");
}