diff --git a/cake/console/libs/tasks/controller.php b/cake/console/libs/tasks/controller.php index 36fd91600..b7f04bb18 100644 --- a/cake/console/libs/tasks/controller.php +++ b/cake/console/libs/tasks/controller.php @@ -275,8 +275,9 @@ class ControllerTask extends BakeTask { */ function bakeActions($controllerName, $admin = null, $wannaUseSession = true) { $currentModelName = $modelImport = $this->_modelName($controllerName); - if ($this->plugin) { - $modelImport = $this->plugin . '.' . $modelImport; + $plugin = $this->plugin; + if ($plugin) { + $modelImport = $plugin . '.' . $modelImport; } if (!App::import('Model', $modelImport)) { $this->err(__('You must have a model for this class to build basic methods. Please try again.', true)); @@ -290,7 +291,7 @@ class ControllerTask extends BakeTask { $singularHumanName = $this->_singularHumanName($controllerName); $pluralHumanName = $this->_pluralName($controllerName); - $this->Template->set(compact('admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName', + $this->Template->set(compact('plugin', 'admin', 'controllerPath', 'pluralName', 'singularName', 'singularHumanName', 'pluralHumanName', 'modelObj', 'wannaUseSession', 'currentModelName')); $actions = $this->Template->generate('actions', 'controller_actions'); return $actions; diff --git a/cake/tests/cases/console/libs/tasks/controller.test.php b/cake/tests/cases/console/libs/tasks/controller.test.php index 0fbc888ff..618b0dfd3 100644 --- a/cake/tests/cases/console/libs/tasks/controller.test.php +++ b/cake/tests/cases/console/libs/tasks/controller.test.php @@ -299,6 +299,8 @@ class ControllerTaskTest extends CakeTestCase { $this->Task->expectAt(1, 'createFile', array( $path, new PatternExpectation('/ArticlesController extends ControllerTestAppController/'))); $this->Task->bake('Articles', '--actions--', array(), array(), array()); + + $this->assertEqual($this->Task->Template->templateVars['plugin'], 'ControllerTest'); } /**