function views_handler_join_chado_aggregator::aggregate_join
1.x views_handler_join_chado_aggregator.inc | views_handler_join_chado_aggregator::aggregate_join(&$query, $opt) |
1 call to views_handler_join_chado_aggregator::aggregate_join()
- views_handler_join_chado_aggregator::join in tripal_views/
views/ handlers/ views_handler_join_chado_aggregator.inc - Creates SQL including aggregation query used in join
File
- tripal_views/
views/ handlers/ views_handler_join_chado_aggregator.inc, line 65 - Handler to allow joins between records via a linking table
Class
- views_handler_join_chado_aggregator
- @file Handler to allow joins between records via a linking table
Code
function aggregate_join(&$query, $opt) {
// Create the table SQL (used in join) -------
// query creating one-to-one table using array_agg
// Only aggregate each field if it the join table hadn't been pre-aggregated
// Example where it might be pre-aggregated: Materialized view
if (!$this->definition['pre-aggregated']) {
$sql = $this->get_aggregate_sql_for_table_field($opt);
// Create the join (full SQL) ----------------
$output[] = $this->create_single_join(
$query,
array(
'table' => $opt['table'],
'field' => $opt['field'],
'table_sql' => $sql,
'is_drupal' => FALSE,
),
array(
'table' => $opt['left_table'],
'field' => $opt['left_field'],
),
'LEFT'
);
// Otherwise the table has been pre-aggregated
// Then only need to do a regular join with any in where
}
else {
// Create the join
$current_table_spec = array(
'table' => $opt['table'],
'field' => $opt['field'],
'is_drupal' => FALSE,
);
$left_table_spec = array(
'table' => $opt['left_table'],
'field' => $opt['left_field'],
);
switch ($opt['table_aggregated']) {
default:
case 'CURRENT':
$current_table_spec['pre-aggregated'] = TRUE;
break;
case 'LEFT':
$left_table_spec['pre-aggregated'] = TRUE;
break;
}
$output[] = $this->create_single_join(
$query,
$current_table_spec,
$left_table_spec,
'LEFT'
);
}
return $output;
}