function chado_views_handler_field::query
3.x chado_views_handler_field.inc | chado_views_handler_field::query( |
1.x chado_views_handler_field.inc | chado_views_handler_field::query() |
Alter the views query to provide information for this field.
We are going to take the same approach as the field api and simply load the entities in order to get the values of the chado fields. The hope is that a small number of cached simple queries will be more efficient than the crazy joins that occur when using chado. *fingers crossed*
File
- tripal_chado/
views_handlers/ chado_views_handler_field.inc, line 21
Class
- chado_views_handler_field
- Views Field Handler for chado fields. Uses the same approach as the field api views_handler_field_field.
Code
function query($use_groupby = FALSE) {
$this->base_table = $this->definition['entity_table'];
$this->base_table_alias = $this->base_table;
$this->ensure_my_table();
// Because we are just loading entities, we need the entity id and type only.
$this->entity = $entity_info = entity_get_info($this->definition['entity_type']);
$alias_stub = 'chado_field_' . $this->definition['chado_table'] . '_' . $this->definition['chado_field'];
$this->id_alias = $this->field_alias = $this->query->add_field($this->base_table_alias, $entity_info['entity keys']['id'], $alias_stub . '_entity_id');
$this->type_alias = $this->query->add_field(NULL, "'" . $this->definition['entity_type'] . "'", $alias_stub . '_entity_type');
}