From 0522f9bbfe686bb7f5470232d1a740d73a7b9b3d Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Tue, 21 May 2013 10:42:32 -0400 Subject: [PATCH] Replaced id2camel with direct implementation --- yii/base/Controller.php | 3 +-- yii/base/Module.php | 3 +-- 2 files changed, 2 insertions(+), 4 deletions(-) diff --git a/yii/base/Controller.php b/yii/base/Controller.php index 0639e2b..543605f 100644 --- a/yii/base/Controller.php +++ b/yii/base/Controller.php @@ -8,7 +8,6 @@ namespace yii\base; use Yii; -use yii\helpers\StringHelper; /** * Controller is the base class for classes containing controller logic. @@ -226,7 +225,7 @@ class Controller extends Component if (isset($actionMap[$id])) { return Yii::createObject($actionMap[$id], $id, $this); } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) { - $methodName = 'action' . StringHelper::id2camel($id); + $methodName = 'action' . str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))); if (method_exists($this, $methodName)) { $method = new \ReflectionMethod($this, $methodName); if ($method->getName() === $methodName) { diff --git a/yii/base/Module.php b/yii/base/Module.php index 98b03db..ec3001e 100644 --- a/yii/base/Module.php +++ b/yii/base/Module.php @@ -8,7 +8,6 @@ namespace yii\base; use Yii; -use yii\helpers\StringHelper; /** * Module is the base class for module and application classes. @@ -609,7 +608,7 @@ abstract class Module extends Component if (isset($this->controllerMap[$id])) { $controller = Yii::createObject($this->controllerMap[$id], $id, $this); } elseif (preg_match('/^[a-z0-9\\-_]+$/', $id)) { - $className = StringHelper::id2camel($id) . 'Controller'; + $className = str_replace(' ', '', ucwords(implode(' ', explode('-', $id)))) . 'Controller'; $classFile = $this->controllerPath . DIRECTORY_SEPARATOR . $className . '.php'; if (!is_file($classFile)) { return false;