PMA\libraries\DisplayResults::_setParamForLinkForeignKeyRelatedTables PHP Method

_setParamForLinkForeignKeyRelatedTables() private method

Set the value of $map array for linking foreign key related tables
See also: getTable()
    private function _setParamForLinkForeignKeyRelatedTables(&$map)
    {
        // To be able to later display a link to the related table,
        // we verify both types of relations: either those that are
        // native foreign keys or those defined in the phpMyAdmin
        // configuration storage. If no PMA storage, we won't be able
        // to use the "column to display" notion (for example show
        // the name related to a numeric id).
        $exist_rel = PMA_getForeigners($this->__get('db'), $this->__get('table'), '', self::POSITION_BOTH);
        if (!empty($exist_rel)) {
            foreach ($exist_rel as $master_field => $rel) {
                if ($master_field != 'foreign_keys_data') {
                    $display_field = PMA_getDisplayField($rel['foreign_db'], $rel['foreign_table']);
                    $map[$master_field] = array($rel['foreign_table'], $rel['foreign_field'], $display_field, $rel['foreign_db']);
                } else {
                    foreach ($rel as $key => $one_key) {
                        foreach ($one_key['index_list'] as $index => $one_field) {
                            $display_field = PMA_getDisplayField(isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $GLOBALS['db'], $one_key['ref_table_name']);
                            $map[$one_field] = array($one_key['ref_table_name'], $one_key['ref_index_list'][$index], $display_field, isset($one_key['ref_db_name']) ? $one_key['ref_db_name'] : $GLOBALS['db']);
                        }
                    }
                }
            }
            // end while
        }
        // end if
    }
DisplayResults