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

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

Params:

Returns:

Example:


<?php

use pq\Gateway\Table;

$email = new Table("account_email");
$relation = new Table\Relations($email);
$account $relation->getReference("account");

var_dump($account);

?>

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"
  }
}