From 3895f56ee57acd1649c06aa544c8175fdbc83868 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Florian=20Kr=C3=A4mer?= Date: Sat, 1 Nov 2014 03:46:33 +0100 Subject: [PATCH] Fixing the NS that is generated in the templates. The convention is to use / for plugin NS but this conflicts with phps \ for the php NS. --- src/Shell/Task/ControllerTask.php | 1 + src/Shell/Task/ModelTask.php | 2 +- src/Shell/Task/TestTask.php | 1 + 3 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Shell/Task/ControllerTask.php b/src/Shell/Task/ControllerTask.php index e79c82cddef..9f423087223 100644 --- a/src/Shell/Task/ControllerTask.php +++ b/src/Shell/Task/ControllerTask.php @@ -158,6 +158,7 @@ public function bakeController($controllerName, array $data) { 'plugin' => null, 'pluginPath' => null, ]; + $data['namespace'] = str_replace('/', '\\', $data['namespace']); $this->Template->set($data); $contents = $this->Template->generate('classes', 'controller'); diff --git a/src/Shell/Task/ModelTask.php b/src/Shell/Task/ModelTask.php index a1e86eeb083..0c5f126c315 100644 --- a/src/Shell/Task/ModelTask.php +++ b/src/Shell/Task/ModelTask.php @@ -621,7 +621,7 @@ public function bakeTable($model, array $data = []) { $ns = Configure::read('App.namespace'); $pluginPath = ''; if ($this->plugin) { - $ns = $this->plugin; + $ns = str_replace('/', '\\', $this->plugin); $pluginPath = $this->plugin . '.'; } diff --git a/src/Shell/Task/TestTask.php b/src/Shell/Task/TestTask.php index a283cecfd33..3bc69ac10c3 100644 --- a/src/Shell/Task/TestTask.php +++ b/src/Shell/Task/TestTask.php @@ -195,6 +195,7 @@ public function bake($type, $className) { $this->out("\n" . sprintf('Baking test case for %s ...', $fullClassName), 1, Shell::QUIET); + $namespace = str_replace('/', '\\', $namespace); $this->Template->set('fixtures', $this->_fixtures); $this->Template->set('plugin', $this->plugin); $this->Template->set(compact(