From 2a9a719acc7067c3ee0d8c469c3fc0f227105fce Mon Sep 17 00:00:00 2001 From: Robert Boloc Date: Thu, 17 Oct 2013 16:28:39 +0200 Subject: [PATCH] create the controllers/invokables key when creating controllers --- src/ZFTool/Controller/CreateController.php | 23 ++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/ZFTool/Controller/CreateController.php b/src/ZFTool/Controller/CreateController.php index e3dcb46..13a7c9a 100644 --- a/src/ZFTool/Controller/CreateController.php +++ b/src/ZFTool/Controller/CreateController.php @@ -151,6 +151,29 @@ public function controllerAction() $phtml = true; } + // Add the new controller key to the invokables + $moduleConfig = require "$path/module/$module/config/module.config.php"; + $invokableKey = ucfirst($module) . '\Controller\\' . $ucName; + + if (!in_array($invokableKey, $moduleConfig['controllers']['invokables'])) { + $moduleConfig['controllers']['invokables'][$invokableKey] = ucfirst($module) . '\Controller\\' . $controller; + copy("$path/module/$module/config/module.config.php", "$path/module/$module/config/module.config.old"); + + $content = <<generate()) && $phtml == true) { $console->writeLine("The controller $name has been created in module $module.", Color::GREEN); } else {