Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/phpmyadmin/phpmyadmin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAtul Pratap Singh <atulpratapsingh05@gmail.com>2015-07-06 10:11:16 +0300
committerAtul Pratap Singh <atulpratapsingh05@gmail.com>2015-07-06 10:19:19 +0300
commitca61c3ace83942195b40a49b25c8dfa0f71adaf6 (patch)
tree471dd97b77f7e6520871cc588622084b456f1724 /tbl_indexes.php
parentf8bd03cecc58fb01b8319f4ae8105c0bae384221 (diff)
Achieve constructor injection usign the introduced DIC
Signed-off-by: Atul Pratap Singh <atulpratapsingh05@gmail.com>
Diffstat (limited to 'tbl_indexes.php')
-rw-r--r--tbl_indexes.php36
1 files changed, 34 insertions, 2 deletions
diff --git a/tbl_indexes.php b/tbl_indexes.php
index 1111408024..f2bef4fcb5 100644
--- a/tbl_indexes.php
+++ b/tbl_indexes.php
@@ -6,9 +6,41 @@
* @package PhpMyAdmin
*/
+namespace PMA;
+
+use PMA_Index;
+
+require_once 'libraries/di/Container.class.php';
require_once 'libraries/controllers/TableIndexesController.class.php';
+require_once 'libraries/Index.class.php';
+
+$container = DI\Container::getDefaultContainer();
+$container->factory('PMA\Controllers\Table\TableIndexesController');
+$container->alias('TableIndexesController', 'PMA\Controllers\Table\TableIndexesController');
+
+/* Define dependencies for the concerned controller */
+$db = $container->get('db');
+$table = $container->get('table');
+$dbi = $container->get('dbi');
+
+if (!isset($_REQUEST['create_edit_table'])) {
+ include_once 'libraries/tbl_common.inc.php';
+}
+if (isset($_REQUEST['index'])) {
+ if (is_array($_REQUEST['index'])) {
+ // coming already from form
+ $index = new PMA_Index($_REQUEST['index']);
+ } else {
+ $index = $dbi->getTable($db, $table)->getIndex($_REQUEST['index']);
+ }
+} else {
+ $index = new PMA_Index;
+}
-use PMA\Controllers\Table\TableIndexesController;
+$dependency_definitions = array(
+ "index" => $index
+);
-$controller = new TableIndexesController();
+/** @var Controllers\Table\TableIndexesController $controller */
+$controller = $container->get('TableIndexesController', $dependency_definitions);
$controller->indexAction();