diff --git a/src/Console/Command/Task/ControllerTask.php b/src/Console/Command/Task/ControllerTask.php index cec5f64e1ff..0bfa716dc81 100644 --- a/src/Console/Command/Task/ControllerTask.php +++ b/src/Console/Command/Task/ControllerTask.php @@ -127,6 +127,7 @@ public function bake($controllerName) { $namespace = Configure::read('App.namespace'); if ($this->plugin) { $namespace = $this->plugin; + $this->pathFragment = 'src/' . $this->pathFragment; } $data = compact( diff --git a/src/Console/Command/Task/FixtureTask.php b/src/Console/Command/Task/FixtureTask.php index ceb3d950d1a..903d31658dd 100644 --- a/src/Console/Command/Task/FixtureTask.php +++ b/src/Console/Command/Task/FixtureTask.php @@ -45,7 +45,7 @@ public function getPath() { $dir = 'Test/Fixture/'; $path = ROOT . DS . $dir; if (isset($this->plugin)) { - $path = $this->_pluginPath($this->plugin) . $dir; + $path = $this->_pluginPath($this->plugin) . 'tests/TestCase/'; } return str_replace('/', DS, $path); } diff --git a/src/Console/Command/Task/ModelTask.php b/src/Console/Command/Task/ModelTask.php index 13ff6162366..5a4b78c3e93 100644 --- a/src/Console/Command/Task/ModelTask.php +++ b/src/Console/Command/Task/ModelTask.php @@ -109,6 +109,10 @@ public function bake($name) { $validation = $this->getValidation($model); $behaviors = $this->getBehaviors($model); + if ($this->plugin) { + $this->pathFragment = 'src/' . $this->pathFragment; + } + $data = compact( 'associations', 'primaryKey', 'displayField', 'table', 'fields', 'validation', 'behaviors' diff --git a/src/Console/Command/Task/SimpleBakeTask.php b/src/Console/Command/Task/SimpleBakeTask.php index f84c788e8e2..2c486a68254 100644 --- a/src/Console/Command/Task/SimpleBakeTask.php +++ b/src/Console/Command/Task/SimpleBakeTask.php @@ -90,6 +90,10 @@ public function main($name = null) { * @return void */ public function bake($name) { + if ($this->plugin) { + $this->pathFragment = 'src/' . $this->pathFragment; + } + $this->Template->set('name', $name); $this->Template->set($this->templateData()); $contents = $this->Template->generate('classes', $this->template()); diff --git a/src/Console/Command/Task/TestTask.php b/src/Console/Command/Task/TestTask.php index 851bae15db8..57c0fa8a85f 100644 --- a/src/Console/Command/Task/TestTask.php +++ b/src/Console/Command/Task/TestTask.php @@ -466,7 +466,7 @@ public function getPath() { $dir = 'Test/TestCase/'; $path = ROOT . DS . $dir; if (isset($this->plugin)) { - $path = $this->_pluginPath($this->plugin) . $dir; + $path = $this->_pluginPath($this->plugin) . 'tests/TestCase/'; } return $path; } diff --git a/src/Console/Command/Task/ViewTask.php b/src/Console/Command/Task/ViewTask.php index d2bbaef76ea..e877a5c47e4 100644 --- a/src/Console/Command/Task/ViewTask.php +++ b/src/Console/Command/Task/ViewTask.php @@ -313,6 +313,9 @@ public function customAction() { * @return string Generated file content. */ public function bake($action, $content = '') { + if ($this->plugin) { + $this->pathFragment = 'src/' . $this->pathFragment; + } if ($content === true) { $content = $this->getContent($action); }