public function ChadoField::queryOrder

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

Overrides TripalField::queryOrder

See also

TripalField::queryOrder()

16 methods override ChadoField::queryOrder()
chado_linker__contact::queryOrder in tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc
chado_linker__prop::queryOrder in tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc
data__accession::queryOrder in tripal_chado/includes/TripalFields/data__accession/data__accession.inc
Used to sort records that have been filtered.
data__sequence_coordinates::queryOrder in tripal_chado/includes/TripalFields/data__sequence_coordinates/data__sequence_coordinates.inc
local__contact::queryOrder in tripal_chado/includes/TripalFields/local__contact/local__contact.inc

... See full list

File

tripal_chado/includes/TripalFields/ChadoField.inc, line 93

Class

ChadoField

Code

public function queryOrder($query, $order) {


  // If we are here it is because the child class did not implement the
  // queryOrder function.  So, we will do our best to make the query work.
  $chado_table = $this->instance['settings']['chado_table'];
  $base_table = $this->instance['settings']['base_table'];
  $bschema = chado_get_schema($base_table);
  $bpkey = $bschema['primary key'][0];
  $alias = 'dbx_linker';
  $operator = $condition['operator'];

  // If the chado_table and the base_table are the same then this is easy.
  if ($chado_table == $base_table) {
    // Get the base table column that is associated with the term
    // passed as $condition['column'].
    $base_field = chado_get_semweb_column($chado_table, $order['column']);
    $query->orderBy('base.' . $base_field, $order['direction']);
  }
  else {
    // If the two are not the same then we expect that the child class
    // will implement a query() function.
  }
}