1 # pq\Gateway\Table\Relations pq\Gateway\Table::getRelations()
3 Get the relations (by foreign key) of this table.
11 * pq\Gateway\Table\Relations, the table's foreign keys.
19 $conn = new pq\Connection;
21 -- drop table if exists account cascade;
22 -- create table account (
23 -- id uuid default uuid_generate_v4() primary key,
28 -- drop table if exists account_email cascade;
29 -- create table account_email (
30 -- account_id uuid not null references account(id) on delete cascade,
31 -- email varchar(255) not null unique,
32 -- primary key (account_id, email)
35 drop table if exists reftable cascade;
36 create table reftable (
37 id serial primary key,
38 my_account uuid references account(id),
39 account_id uuid references account(id),
40 second_account_id uuid references account(id),
41 email varchar(255) not null references account_email(email)
45 $fgn_table = new Table("reftable");
46 var_dump($fgn_table->getRelations());
52 object(pq\Gateway\Table\Relations)#7 (1) {
53 ["references":protected]=>
58 object(pq\Gateway\Table\Reference)#14 (5) {
60 string(10) "my_account"
66 string(10) "my_account"
70 ["referencedColumns"]=>
77 object(pq\Gateway\Table\Reference)#15 (5) {
85 string(10) "account_id"
89 ["referencedColumns"]=>
96 object(pq\Gateway\Table\Reference)#16 (5) {
98 string(14) "second_account"
104 string(17) "second_account_id"
106 ["referencedTable"]=>
108 ["referencedColumns"]=>
118 object(pq\Gateway\Table\Reference)#17 (5) {
128 ["referencedTable"]=>
129 string(13) "account_email"
130 ["referencedColumns"]=>