phpmyadmin/libraries/classes/Controllers/TableController.php
Maurício Meneghini Fauth 111cb5db40 Extract controllers from AjaxController
Extracts the config set and get to the ConfigController, the databases
list to the DatabaseController, the tables list to the TableController
and the columns list to the ColumnController.

Signed-off-by: Maurício Meneghini Fauth <mauricio@fauth.dev>
2020-10-12 19:57:17 -03:00

39 lines
867 B
PHP

<?php
declare(strict_types=1);
namespace PhpMyAdmin\Controllers;
use PhpMyAdmin\DatabaseInterface;
use PhpMyAdmin\Message;
use PhpMyAdmin\Response;
use PhpMyAdmin\Template;
final class TableController extends AbstractController
{
/** @var DatabaseInterface */
private $dbi;
/**
* @param Response $response
* @param DatabaseInterface $dbi
*/
public function __construct($response, Template $template, $dbi)
{
parent::__construct($response, $template);
$this->dbi = $dbi;
}
public function all(): void
{
if (! isset($_POST['db'])) {
$this->response->setRequestStatus(false);
$this->response->addJSON(['message' => Message::error()]);
return;
}
$this->response->addJSON(['tables' => $this->dbi->getTables($_POST['db'])]);
}
}