Translated using Weblate (Czech)
[phpmyadmin.git] / tbl_relation.php
blob349e59768c5f1e444bc0c003e3fe173acc4d98f1
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 /**
18 * Get the TableRelationController
20 namespace PMA;
22 use PMA_Table;
23 use PMA_Util;
25 require_once 'libraries/di/Container.class.php';
26 require_once 'libraries/controllers/TableRelationController.class.php';
27 require_once 'libraries/Table.class.php';
28 require_once 'libraries/Util.class.php';
30 $container = DI\Container::getDefaultContainer();
31 $container->factory('PMA\Controllers\Table\TableRelationController');
32 $container->alias('TableRelationController', 'PMA\Controllers\Table\TableRelationController');
34 /* Define dependencies for the concerned controller */
35 $db = $container->get('db');
36 $table = $container->get('table');
37 $dbi = $container->get('dbi');
38 $options_array = array(
39 'CASCADE' => 'CASCADE',
40 'SET_NULL' => 'SET NULL',
41 'NO_ACTION' => 'NO ACTION',
42 'RESTRICT' => 'RESTRICT',
44 $cfgRelation = PMA_getRelationsParam();
45 $tbl_storage_engine = /*overload*/
46 mb_strtoupper(
47 PMA_Table::sGetStatusInfo(
48 $db,
49 $table,
50 'Engine'
53 $upd_query = new PMA_Table($table, $db, $dbi);
55 $dependency_definitions = array(
56 "options_array" => $options_array,
57 "cfgRelation" => $cfgRelation,
58 "tbl_storage_engine" => $tbl_storage_engine,
59 "upd_query" => $upd_query
61 if ($cfgRelation['relwork']) {
62 $dependency_definitions['existrel'] = PMA_getForeigners($db, $table, '', 'internal');
64 if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
65 $dependency_definitions['existrel_foreign'] = PMA_getForeigners($db, $table, '', 'foreign');
67 if ($cfgRelation['displaywork']) {
68 $dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
69 } else {
70 $dependency_definitions['disp'] = 'asas';
73 /** @var Controllers\Table\TableRelationController $controller */
74 $controller = $container->get('TableRelationController', $dependency_definitions);
75 $controller->indexAction();