]> gitweb.fluxo.info Git - lorea/elgg.git/commitdiff
Fixes #3496 finished up this ticket by updating unit test and using more parantheses...
authorcash <cash.costello@gmail.com>
Tue, 29 Nov 2011 02:24:42 +0000 (21:24 -0500)
committercash <cash.costello@gmail.com>
Tue, 29 Nov 2011 02:24:42 +0000 (21:24 -0500)
engine/lib/river.php
engine/tests/api/river.php

index 02d52dea147ad6b4464927ad7c4271d415651318..4218134415620d69032bd178a9171a84e8cf807f 100644 (file)
@@ -207,6 +207,8 @@ function elgg_delete_river(array $options = array()) {
 /**
  * Get river items
  *
+ * @note If using types and subtypes in a query, they are joined with an AND.
+ *
  * @param array $options
  *   ids                  => INT|ARR River item id(s)
  *   subject_guids        => INT|ARR Subject guid(s)
@@ -430,7 +432,6 @@ function elgg_river_get_access_sql() {
  *
  * @internal This is a simplified version of elgg_get_entity_type_subtype_where_sql()
  * which could be used for all queries once the subtypes have been denormalized.
- * FYI: It allows types and subtypes to not be paired.
  *
  * @param string     $table    'rv'
  * @param NULL|array $types    Array of types or NULL if none.
@@ -477,7 +478,7 @@ function elgg_get_river_type_subtype_where_sql($table, $types, $subtypes, $pairs
                }
 
                if (is_array($subtypes_wheres) && count($subtypes_wheres)) {
-                       $subtypes_wheres = array(implode(' OR ', $subtypes_wheres));
+                       $subtypes_wheres = array('(' . implode(' OR ', $subtypes_wheres) . ')');
                }
 
                $wheres = array(implode(' AND ', array_merge($types_wheres, $subtypes_wheres)));
index 55ddbfeec41b7ce0fb86192c4aa9c0f22054424a..6931b9f41c2f2d7d52f94f40aaa95d5438f03080 100644 (file)
@@ -11,7 +11,7 @@ class ElggCoreRiverAPITest extends ElggCoreUnitTest {
                $types = array('object');
                $subtypes = array('blog');
                $result = elgg_get_river_type_subtype_where_sql('rv', $types, $subtypes, null);
-               $this->assertIdentical($result, "((rv.type = 'object') AND (rv.subtype = 'blog'))");
+               $this->assertIdentical($result, "((rv.type = 'object') AND ((rv.subtype = 'blog')))");
 
                $types = array('object');
                $subtypes = array('blog', 'file');