mixed
pq\Gateway\Table::by(pq\Gateway\Row $me[, string
$ref = NULL
])Find the row inthis table referenced by another table's row by foreign key. See pq\Gateway\Table::find(), pq\Gateway\Table::of() and pq\Gateway\Row::ofWhich().
string
$ref# = NULL
<?php
use pq\Gateway\Table;
$accounts = new Table("account");
$account_emails = new Table("account_email");
$email = $account_emails->find(["email=" => "mike@php.net"])->current();
$account1 = $accounts->by($email)->current();
$account2 = $email->ofWhich("account")->current();
var_dump($account1->getData(), $account2->getData());
?>
Yields:
array(3) {
["id"]=>
string(36) "f9710801-c900-4774-848c-22c85deecd83"
["password"]=>
NULL
["name"]=>
string(4) "mike"
}
array(3) {
["id"]=>
string(36) "f9710801-c900-4774-848c-22c85deecd83"
["password"]=>
NULL
["name"]=>
string(4) "mike"
}