]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #1472: get_entity_relationships() supports inverse relationships.
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 29 Jan 2010 19:11:02 +0000 (19:11 +0000)
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>
Fri, 29 Jan 2010 19:11:02 +0000 (19:11 +0000)
git-svn-id: http://code.elgg.org/elgg/trunk@3856 36083f99-b078-4883-b0ff-0f9b5a30f544

CHANGES.txt
engine/lib/relationships.php

index 5414aefefcc624e62ad5eb4e939322545a71c143..d88332adf8d0aae408b86469d2968c85e616d22c 100644 (file)
@@ -19,6 +19,7 @@ http://code.elgg.org/elgg/.....
   * ElggPlugin get() now works with 0. #1286
   * Metadata __isset() now works for falsy values (except NULL). #1414
   * clear_plugin_setting() now only clears a single setting.
+  * Submenu entries are correctly calculated after a simplecache refresh.
 
  API changes:
   * New plugin hook system:unit_test for adding files to unit tests.
@@ -33,6 +34,7 @@ http://code.elgg.org/elgg/.....
   * remove_from_river_by_annotation() added.
   * unregister_elgg_event_handler() and unregister_plugin_hook() added. #1465
   * clear_all_plugin_settings() added.
+  * get_entity_relationships() supports inverse relationships. #1472.
 
  Services API:
   * Separated user and api authenticate processing
index d84e70bfb0d126a7c1272d319d7dfc3a85ca0818..c1f54472ade3ce7ed1fc54e7bd9d4d7b6a842b05 100644 (file)
@@ -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");
 }