pq\Gateway\Table\Reference pq\Gateway\Table::getRelation(string $table[, string $ref = NULL])

Retrieve the foreign key of the table to another table. See pq\Gateway\Table\Relations::getReference().

Params:

Returns:

Example:


<?php

use pq\Gateway\Table;

$email = new Table("account_email");
$ref $email->getRelation("account");

var_dump($ref);

?>

Yields:


object(pq\Gateway\Table\Reference)#12 (5) {
  ["name"]=>
  string(7) "account"
  ["foreignTable"]=>
  string(13) "account_email"
  ["foreignColumns"]=>
  array(1) {
    [0]=>
    string(10) "account_id"
  }
  ["referencedTable"]=>
  string(7) "account"
  ["referencedColumns"]=>
  array(1) {
    [0]=>
    string(2) "id"
  }
}