diff options
Diffstat (limited to 'libraries')
4 files changed, 38 insertions, 7 deletions
diff --git a/libraries/classes/Controllers/Normalization/SecondNormalForm/FirstStepController.php b/libraries/classes/Controllers/Normalization/SecondNormalForm/FirstStepController.php new file mode 100644 index 0000000000..e0f59b6c90 --- /dev/null +++ b/libraries/classes/Controllers/Normalization/SecondNormalForm/FirstStepController.php @@ -0,0 +1,29 @@ +<?php + +declare(strict_types=1); + +namespace PhpMyAdmin\Controllers\Normalization\SecondNormalForm; + +use PhpMyAdmin\Controllers\AbstractController; +use PhpMyAdmin\Http\ServerRequest; +use PhpMyAdmin\Normalization; +use PhpMyAdmin\ResponseRenderer; +use PhpMyAdmin\Template; + +final class FirstStepController extends AbstractController +{ + /** @var Normalization */ + private $normalization; + + public function __construct(ResponseRenderer $response, Template $template, Normalization $normalization) + { + parent::__construct($response, $template); + $this->normalization = $normalization; + } + + public function __invoke(ServerRequest $request): void + { + $res = $this->normalization->getHtmlFor2NFstep1($GLOBALS['db'], $GLOBALS['table']); + $this->response->addJSON($res); + } +} diff --git a/libraries/classes/Controllers/NormalizationController.php b/libraries/classes/Controllers/NormalizationController.php index 5d48db966d..7886423ce7 100644 --- a/libraries/classes/Controllers/NormalizationController.php +++ b/libraries/classes/Controllers/NormalizationController.php @@ -143,13 +143,6 @@ class NormalizationController extends AbstractController return; } - if (isset($_POST['step']) && $_POST['step'] == '2.1') { - $res = $this->normalization->getHtmlFor2NFstep1($GLOBALS['db'], $GLOBALS['table']); - $this->response->addJSON($res); - - return; - } - if (isset($_POST['step']) && $_POST['step'] == '3.1') { $tables = $_POST['tables']; $res = $this->normalization->getHtmlFor3NFstep1($GLOBALS['db'], $tables); diff --git a/libraries/routes.php b/libraries/routes.php index 5da6ea4b34..dad41d8b24 100644 --- a/libraries/routes.php +++ b/libraries/routes.php @@ -136,6 +136,7 @@ return static function (RouteCollector $routes): void { $routes->post('/1nf/step2', Normalization\FirstNormalForm\SecondStepController::class); $routes->post('/1nf/step3', Normalization\FirstNormalForm\ThirdStepController::class); $routes->post('/1nf/step4', Normalization\FirstNormalForm\FourthStepController::class); + $routes->post('/2nf/step1', Normalization\SecondNormalForm\FirstStepController::class); }); $routes->get('/phpinfo', PhpInfoController::class); $routes->addGroup('/preferences', static function (RouteCollector $routes): void { diff --git a/libraries/services_controllers.php b/libraries/services_controllers.php index 944fa534f3..9009548946 100644 --- a/libraries/services_controllers.php +++ b/libraries/services_controllers.php @@ -617,6 +617,14 @@ return [ '$normalization' => '@normalization', ], ], + Normalization\SecondNormalForm\FirstStepController::class => [ + 'class' => Normalization\SecondNormalForm\FirstStepController::class, + 'arguments' => [ + '$response' => '@response', + '$template' => '@template', + '$normalization' => '@normalization', + ], + ], NormalizationController::class => [ 'class' => NormalizationController::class, 'arguments' => [ |