public function chado_linker__prop::queryOrder

3.x chado_linker__prop.inc public chado_linker__prop::queryOrder($query, $order)

Overrides ChadoField::queryOrder

See also

ChadoField::query()

File

tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc, line 165

Class

chado_linker__prop

Code

public function queryOrder($query, $order) {
  $prop_linker = $this->instance['settings']['chado_table'];
  $base_table = $this->instance['settings']['base_table'];

  $bschema = chado_get_schema($base_table);
  $bpkey = $bschema['primary key'][0];
  $alias = $this->field['field_name'];

  $vocab = $this->instance['settings']['term_vocabulary'];
  $accession = $this->instance['settings']['term_accession'];

  $cvterm = chado_get_cvterm(array('id' => $vocab . ':' . $accession));

  $this->queryJoinOnce($query, $prop_linker, $alias, "base.$bpkey = $alias.$bpkey AND $alias.type_id = $cvterm->cvterm_id", "LEFT OUTER");
  $query->orderBy("$alias.value", $order['direction']);
}