aboutsummaryrefslogtreecommitdiff
path: root/engine/lib/annotations.php
diff options
context:
space:
mode:
authorbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-21 19:36:47 +0000
committerbrettp <brettp@36083f99-b078-4883-b0ff-0f9b5a30f544>2011-04-21 19:36:47 +0000
commitc06885114ab45eb1f24ff26e23ab317b8bd7604e (patch)
treeb7336c6e0415a8783efec4d86f0623cce0405c7f /engine/lib/annotations.php
parentb4e32ff5baa72ebbc61ce983feb78b82f1bd9684 (diff)
downloadelgg-c06885114ab45eb1f24ff26e23ab317b8bd7604e.tar.gz
elgg-c06885114ab45eb1f24ff26e23ab317b8bd7604e.tar.bz2
Fixed a problem with the annotation batch operation test.
git-svn-id: http://code.elgg.org/elgg/trunk@9009 36083f99-b078-4883-b0ff-0f9b5a30f544
Diffstat (limited to 'engine/lib/annotations.php')
-rw-r--r--engine/lib/annotations.php13
1 files changed, 7 insertions, 6 deletions
diff --git a/engine/lib/annotations.php b/engine/lib/annotations.php
index 7a4e62921..ca8f6b2e1 100644
--- a/engine/lib/annotations.php
+++ b/engine/lib/annotations.php
@@ -404,6 +404,7 @@ function elgg_list_entities_from_annotations($options = array()) {
* @return mixed
*/
function elgg_get_entities_from_annotation_calculation($options) {
+ $db_prefix = elgg_get_config('dbprefix');
$defaults = array(
'calculation' => 'sum',
'order_by' => 'calculation desc'
@@ -415,14 +416,14 @@ function elgg_get_entities_from_annotation_calculation($options) {
// you must cast this as an int or it sorts wrong.
$options['selects'][] = 'e.*';
- $options['selects'][] = "$function(cast(v.string as signed)) as calculation";
+// $options['selects'][] = 'a_msv as value';
+ $options['selects'][] = "$function(cast(a_msv.string as signed)) as calculation";
- // need our own join to get the values.
-// $options['joins'][] = "JOIN {$db_prefix}metastrings msv ON a.value_id = msv.id";
-// $options['joins'][] = "JOIN {$db_prefix}entities ae ON a.entity_guid = ae.guid";
+ // need our own join to get the values because the lower level functions don't
+ // add all the joins if it's a different callback.
+ $options['joins'][] = "JOIN {$db_prefix}metastrings a_msv ON n_table.value_id = a_msv.id";
- $options['wheres'][] = get_access_sql_suffix('n_table');
-// $options['wheres'][] = "e.guid = a.entity_guid";
+ // don't need access control because it's taken care of by elgg_get_annotations.
$options['group_by'] = 'n_table.entity_guid';
$options['callback'] = 'entity_row_to_elggstar';