Translated using Weblate (Interlingua)
[phpmyadmin.git] / tbl_relation.php
blob1074a3a72400306572ef09e522a1d816e7eebb09
1 <?php
2 /* vim: set expandtab sw=4 ts=4 sts=4: */
3 /**
4 * Display table relations for viewing and editing
6 * includes phpMyAdmin relations and InnoDB relations
8 * @todo fix name handling: currently names with dots (.) are not properly handled
9 * for internal relations (but foreign keys relations are correct)
10 * @todo foreign key constraints require both fields being of equal type and size
11 * @todo check foreign fields to be from same type and size, all other makes no sense
12 * @todo if above todos are fullfilled we can add all fields meet requirements
13 * in the select dropdown
14 * @package PhpMyAdmin
17 use PhpMyAdmin\Controllers\Table\TableRelationController;
18 use PhpMyAdmin\Di\Container;
19 use PhpMyAdmin\Relation;
20 use PhpMyAdmin\Response;
21 use PhpMyAdmin\Table;
22 use PhpMyAdmin\Util;
24 require_once 'libraries/common.inc.php';
26 $container = Container::getDefaultContainer();
27 $container->factory('PhpMyAdmin\Controllers\Table\TableRelationController');
28 $container->alias(
29 'TableRelationController',
30 'PhpMyAdmin\Controllers\Table\TableRelationController'
32 $container->set('PhpMyAdmin\Response', Response::getInstance());
33 $container->alias('response', 'PhpMyAdmin\Response');
35 /* Define dependencies for the concerned controller */
36 $db = $container->get('db');
37 $table = $container->get('table');
38 $dbi = $container->get('dbi');
39 $options_array = array(
40 'CASCADE' => 'CASCADE',
41 'SET_NULL' => 'SET NULL',
42 'NO_ACTION' => 'NO ACTION',
43 'RESTRICT' => 'RESTRICT',
45 $cfgRelation = Relation::getRelationsParam();
46 $tbl_storage_engine = mb_strtoupper(
47 $dbi->getTable($db, $table)->getStatusInfo('Engine')
49 $upd_query = new Table($table, $db, $dbi);
51 $dependency_definitions = array(
52 "options_array" => $options_array,
53 "cfgRelation" => $cfgRelation,
54 "tbl_storage_engine" => $tbl_storage_engine,
55 "upd_query" => $upd_query
57 if ($cfgRelation['relwork']) {
58 $dependency_definitions['existrel'] = Relation::getForeigners(
59 $db, $table, '', 'internal'
62 if (Util::isForeignKeySupported($tbl_storage_engine)) {
63 $dependency_definitions['existrel_foreign'] = Relation::getForeigners(
64 $db, $table, '', 'foreign'
68 /** @var TableRelationController $controller */
69 $controller = $container->get('TableRelationController', $dependency_definitions);
70 $controller->indexAction();