Define correctly the Database\StructureController parameters

Signed-off-by: Hugues Peccatte <hugues.peccatte@gmail.com>
This commit is contained in:
Hugues Peccatte 2019-06-05 22:19:19 +02:00
parent ac5a95ca84
commit 8dc906e923
2 changed files with 1 additions and 19 deletions

View File

@ -10,14 +10,11 @@ declare(strict_types=1);
use PhpMyAdmin\Controllers\Database\StructureController;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Response;
use Symfony\Component\DependencyInjection\Definition;
if (! defined('ROOT_PATH')) {
define('ROOT_PATH', __DIR__ . DIRECTORY_SEPARATOR);
}
global $db;
require_once ROOT_PATH . 'libraries/common.inc.php';
require_once ROOT_PATH . 'libraries/db_common.inc.php';
@ -27,21 +24,6 @@ $response = $containerBuilder->get(Response::class);
/** @var DatabaseInterface $dbi */
$dbi = $containerBuilder->get(DatabaseInterface::class);
/* Define dependencies for the concerned controller */
$dependency_definitions = [
'db' => $db,
];
/** @var Definition $definition */
$definition = $containerBuilder->getDefinition(StructureController::class);
array_map(
static function (string $parameterName, $value) use ($definition) {
$definition->replaceArgument($parameterName, $value);
},
array_keys($dependency_definitions),
$dependency_definitions
);
/** @var StructureController $controller */
$controller = $containerBuilder->get(StructureController::class);

View File

@ -73,7 +73,7 @@ services:
response: '@response'
dbi: '@dbi'
template: '@template'
db: null
db: '%db%'
relation: '@relation'
replication: '@replication'