You are here

public function DataTable::link in Data 6

Same name and namespace in other branches
  1. 7 includes/DataTable.inc \DataTable::link()

Link this table to another table. Linking a table to another one is to define how data in these tables should be joined to each other.

There can be more than one link to the left of a table. However, for views integration, only the first join created will be used.

@todo: Get rid of link() language, use setJoin()/removeJoin() instead.

File

includes/DataTable.inc, line 526
Contains class definition for DataTable.

Class

DataTable
Manages data access and manipulation for a single data table. Use data_create_table() or data_get_table() to instantiate an object from this class.

Code

public function link($left_table, $left_field, $field = NULL, $inner_join = TRUE) {
  if ($field == NULL) {
    $field = $left_table;
  }
  $this->meta['join'][$left_table] = array(
    'left_field' => $left_field,
    'field' => $field,
    'inner_join' => $inner_join,
  );
  $this
    ->update(array(
    'meta' => $this->meta,
  ));
}