dbi = $dbi; } public function __invoke(): void { $GLOBALS['sql_autocomplete'] = true; if ($GLOBALS['cfg']['EnableAutocompleteForTablesAndColumns']) { $GLOBALS['db'] = $_POST['db'] ?? $GLOBALS['db']; $GLOBALS['sql_autocomplete'] = []; if ($GLOBALS['db']) { $tableNames = $this->dbi->getTables($GLOBALS['db']); foreach ($tableNames as $tableName) { $GLOBALS['sql_autocomplete'][$tableName] = $this->dbi->getColumns($GLOBALS['db'], $tableName); } } } $this->response->addJSON(['tables' => json_encode($GLOBALS['sql_autocomplete'])]); } }