Translated using Weblate (Slovenian)
[phpmyadmin.git] / tbl_relation.php
blob4a767856e1f2c0b1d6150f0ff79b14cc542b59e7
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(
33 'TableRelationController', 'PMA\Controllers\Table\TableRelationController'
36 /* Define dependencies for the concerned controller */
37 $db = $container->get('db');
38 $table = $container->get('table');
39 $dbi = $container->get('dbi');
40 $options_array = array(
41 'CASCADE' => 'CASCADE',
42 'SET_NULL' => 'SET NULL',
43 'NO_ACTION' => 'NO ACTION',
44 'RESTRICT' => 'RESTRICT',
46 $cfgRelation = PMA_getRelationsParam();
47 $tbl_storage_engine = /*overload*/
48 mb_strtoupper(
49 $GLOBALS['dbi']->getTable($db, $table)->sGetStatusInfo('Engine')
51 $upd_query = new PMA_Table($table, $db, $dbi);
53 $dependency_definitions = array(
54 "options_array" => $options_array,
55 "cfgRelation" => $cfgRelation,
56 "tbl_storage_engine" => $tbl_storage_engine,
57 "upd_query" => $upd_query
59 if ($cfgRelation['relwork']) {
60 $dependency_definitions['existrel'] = PMA_getForeigners(
61 $db, $table, '', 'internal'
64 if (PMA_Util::isForeignKeySupported($tbl_storage_engine)) {
65 $dependency_definitions['existrel_foreign'] = PMA_getForeigners(
66 $db, $table, '', 'foreign'
69 if ($cfgRelation['displaywork']) {
70 $dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
71 } else {
72 $dependency_definitions['disp'] = 'asas';
75 /** @var Controllers\Table\TableRelationController $controller */
76 $controller = $container->get('TableRelationController', $dependency_definitions);
77 $controller->indexAction();