From 77d1dc8a20c14231fd33aaba71630f0c11528bee Mon Sep 17 00:00:00 2001 From: vito8877 Date: Mon, 8 Sep 2014 01:06:09 +0300 Subject: [PATCH] Fixed controller creation When creating controller and it already exists in the module, old controller will be overwritten with controller stub. This patch fixes it. --- src/ZFTool/Controller/CreateController.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/ZFTool/Controller/CreateController.php b/src/ZFTool/Controller/CreateController.php index e4b1f04..58c1bb5 100644 --- a/src/ZFTool/Controller/CreateController.php +++ b/src/ZFTool/Controller/CreateController.php @@ -105,13 +105,13 @@ public function controllerAction() "The path $path doesn't contain a ZF2 application. I cannot create a module here." ); } - if (file_exists("$path/module/$module/src/$module/Controller/$name")) { + $ucName = ucfirst($name); + if (file_exists("$path/module/$module/src/$module/Controller/{$ucName}Controller.php")) { return $this->sendError( - "The controller $name already exists in module $module." + "The controller {$ucName}Controller already exists in module $module." ); } - $ucName = ucfirst($name); $ctrlPath = $path . '/module/' . $module . '/src/' . $module . '/Controller/' . $ucName.'Controller.php'; $controller = $ucName . 'Controller';