Db::getReferencedForeignKeys
Usage
array Db::getReferencedForeignKeys(string $table_name)Description
Get the foreign key constraints that other database tables have on a given database table.Parameters
Parameter | Required | Type | Description |
---|---|---|---|
$table_name | Yes | string | The table name to get referecned foreign key constraints of. |
Return Value
Returns an associative array, the keys being the referenced table and column names, and the value being an associative array of constraint details.Examples
Get Referenced Foreign Keys
$keys = $this->db->getReferencedForeignKeys('user_profiles');
// Primary keys
print_r($keys);
// This will output something like:
Array
(
[user_notes.uuid] => Array
(
[table] => user_profiles
[column] => uuid
[type] => one_to_many
[ref_table] => user_notes
[ref_column] => uuid
)
)