Translated using Weblate (Slovenian)
[phpmyadmin.git] / tbl_relation.php
blobf2f1a3bdac3af1372e46156d8050fcaa5c966df0
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\libraries\controllers\table\TableRelationController;
23 use PMA\libraries\Response;
24 use PMA\libraries\Table;
25 use PMA\libraries\Util;
27 require_once 'libraries/common.inc.php';
29 $container = libraries\di\Container::getDefaultContainer();
30 $container->factory('PMA\libraries\controllers\table\TableRelationController');
31 $container->alias(
32 'TableRelationController',
33 'PMA\libraries\controllers\table\TableRelationController'
35 $container->set('PMA\libraries\Response', Response::getInstance());
36 $container->alias('response', 'PMA\libraries\Response');
38 /* Define dependencies for the concerned controller */
39 $db = $container->get('db');
40 $table = $container->get('table');
41 $dbi = $container->get('dbi');
42 $options_array = array(
43 'CASCADE' => 'CASCADE',
44 'SET_NULL' => 'SET NULL',
45 'NO_ACTION' => 'NO ACTION',
46 'RESTRICT' => 'RESTRICT',
48 $cfgRelation = PMA_getRelationsParam();
49 $tbl_storage_engine = mb_strtoupper(
50 $dbi->getTable($db, $table)->getStatusInfo('Engine')
52 $upd_query = new Table($table, $db, $dbi);
54 $dependency_definitions = array(
55 "options_array" => $options_array,
56 "cfgRelation" => $cfgRelation,
57 "tbl_storage_engine" => $tbl_storage_engine,
58 "upd_query" => $upd_query
60 if ($cfgRelation['relwork']) {
61 $dependency_definitions['existrel'] = PMA_getForeigners(
62 $db, $table, '', 'internal'
65 if (Util::isForeignKeySupported($tbl_storage_engine)) {
66 $dependency_definitions['existrel_foreign'] = PMA_getForeigners(
67 $db, $table, '', 'foreign'
70 if ($cfgRelation['displaywork']) {
71 $dependency_definitions['disp'] = PMA_getDisplayField($db, $table);
72 } else {
73 $dependency_definitions['disp'] = 'asas';
76 /** @var TableRelationController $controller */
77 $controller = $container->get('TableRelationController', $dependency_definitions);
78 $controller->indexAction();