Translated using Weblate (Russian)
[phpmyadmin.git] / tbl_relation.php
blob986cb3c02d86e6a2fc06eaba52e7b62aadc4cfd8
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 $relation = new Relation();
46 $cfgRelation = $relation->getRelationsParam();
47 $tbl_storage_engine = mb_strtoupper(
48 $dbi->getTable($db, $table)->getStatusInfo('Engine')
50 $upd_query = new Table($table, $db, $dbi);
52 $dependency_definitions = array(
53 "options_array" => $options_array,
54 "cfgRelation" => $cfgRelation,
55 "tbl_storage_engine" => $tbl_storage_engine,
56 "upd_query" => $upd_query
58 if ($cfgRelation['relwork']) {
59 $dependency_definitions['existrel'] = $relation->getForeigners(
60 $db, $table, '', 'internal'
63 if (Util::isForeignKeySupported($tbl_storage_engine)) {
64 $dependency_definitions['existrel_foreign'] = $relation->getForeigners(
65 $db, $table, '', 'foreign'
69 /** @var TableRelationController $controller */
70 $controller = $container->get('TableRelationController', $dependency_definitions);
71 $controller->indexAction();