From a6961f3404fdbe68b3cf707e161fd6815901c07e Mon Sep 17 00:00:00 2001 From: Alexander Makarov Date: Sat, 26 Jan 2013 00:21:04 +0100 Subject: [PATCH] patched controller and action creation --- framework/base/Application.php | 13 +++++++------ framework/base/Controller.php | 5 +++-- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/framework/base/Application.php b/framework/base/Application.php index 2e92aab..6d782ec 100644 --- a/framework/base/Application.php +++ b/framework/base/Application.php @@ -211,15 +211,16 @@ class Application extends Module */ public function runController($route, $params = array()) { - $result = $this->createController($route); - if ($result === false) { + list($controller, $action) = explode('/', $route); + + $controllerObject = $this->createController($controller, $this); + if ($controllerObject === false) { throw new InvalidRequestException(\Yii::t('yii', 'Unable to resolve the request.')); } - /** @var $controller Controller */ - list($controller, $action) = $result; + $priorController = $this->controller; - $this->controller = $controller; - $status = $controller->run($action, $params); + $this->controller = $controllerObject; + $status = $controllerObject->run($action, $params); $this->controller = $priorController; return $status; } diff --git a/framework/base/Controller.php b/framework/base/Controller.php index 0df287a..d62cc35 100644 --- a/framework/base/Controller.php +++ b/framework/base/Controller.php @@ -142,8 +142,9 @@ class Controller extends Component if ($actionID === '') { $actionID = $this->defaultAction; } - if (isset($this->actionMap[$actionID])) { - return \Yii::createObject($this->actionMap[$actionID], $actionID, $this); + $actions = $this->actions(); + if (isset($actions[$actionID])) { + return \Yii::createObject($actions[$actionID], $actionID, $this); } elseif (method_exists($this, 'action' . $actionID)) { return new InlineAction($actionID, $this); } else {