protected function ChadoField::queryJoinOnce

3.x ChadoField.inc protected ChadoField::queryJoinOnce($query, $table, $alias, $condition, $type = 'INNER')

A convient way to join a table to a query without duplicates.

Parameters

$query: The SelectQuery object.

$table: The table to join.

$alias: The table alias to use.

$condition: The join condition.

$type: The type of join: INNER, LEFT OUTER, or RIGHT OUTER.

29 calls to ChadoField::queryJoinOnce()
chado_linker__contact::query in tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc
chado_linker__contact::queryOrder in tripal_chado/includes/TripalFields/chado_linker__contact/chado_linker__contact.inc
chado_linker__prop::query in tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc
chado_linker__prop::queryOrder in tripal_chado/includes/TripalFields/chado_linker__prop/chado_linker__prop.inc
data__accession::query in tripal_chado/includes/TripalFields/data__accession/data__accession.inc

... See full list

File

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

Class

ChadoField

Code

protected function queryJoinOnce($query, $table, $alias, $condition, $type = 'INNER') {
  $joins = $query->getTables();

  // If this join is already present then don't add it again.
  if (in_array($alias, array_keys($joins))) {
    return;
  }

  switch ($type) {
    case 'LEFT OUTER':
      $query->leftjoin($table, $alias, $condition);
      break;
    case 'RIGHT OUTER':
      $query->rightjoin($table, $alias, $condition);
      break;
    default:
      $query->innerjoin($table, $alias, $condition);
  }
}