From 94c58ad14cc58b8330bf5fd8cc134cf2658dc8c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E9=A3=9E=E6=89=AC?= <3280204+ycrao@users.noreply.github.com> Date: Sat, 27 Dec 2025 18:18:28 +0800 Subject: [PATCH] Update app_root configuration access in ControllerCommand --- flight/commands/ControllerCommand.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/flight/commands/ControllerCommand.php b/flight/commands/ControllerCommand.php index 9706d97..cfea2ae 100644 --- a/flight/commands/ControllerCommand.php +++ b/flight/commands/ControllerCommand.php @@ -29,7 +29,7 @@ class ControllerCommand extends AbstractBaseCommand public function execute(string $controller) { $io = $this->app()->io(); - if (isset($this->config['app_root']) === false) { + if (isset($this->config['runway']['app_root']) === false) { $io->error('app_root not set in .runway-config.json', true); return; } @@ -38,7 +38,7 @@ class ControllerCommand extends AbstractBaseCommand $controller .= 'Controller'; } - $controllerPath = getcwd() . DIRECTORY_SEPARATOR . $this->config['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php'; + $controllerPath = getcwd() . DIRECTORY_SEPARATOR . $this->config['runway']['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controller . '.php'; if (file_exists($controllerPath) === true) { $io->error($controller . ' already exists.', true); return; @@ -86,6 +86,6 @@ class ControllerCommand extends AbstractBaseCommand protected function persistClass(string $controllerName, PhpFile $file) { $printer = new \Nette\PhpGenerator\PsrPrinter(); - file_put_contents(getcwd() . DIRECTORY_SEPARATOR . $this->config['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controllerName . '.php', $printer->printFile($file)); + file_put_contents(getcwd() . DIRECTORY_SEPARATOR . $this->config['runway']['app_root'] . 'controllers' . DIRECTORY_SEPARATOR . $controllerName . '.php', $printer->printFile($file)); } }