From 6b41d41fd9456b6342b9869b78e12d5be06b7438 Mon Sep 17 00:00:00 2001 From: Qiang Xue Date: Sat, 3 Aug 2013 14:04:36 -0400 Subject: [PATCH] Fixes #711. --- framework/yii/base/Application.php | 10 ++++++++++ framework/yii/base/Module.php | 8 +------- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 0b14a8c..687f1a3 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -180,6 +180,16 @@ abstract class Application extends Module } /** + * Returns an ID that uniquely identifies this module among all modules within the current application. + * Since this is an application instance, it will always return an empty string. + * @return string the unique ID of the module. + */ + public function getUniqueId() + { + return ''; + } + + /** * Runs the application. * This is the main entrance of an application. * @return integer the exit status (0 means normal, non-zero values mean abnormal) diff --git a/framework/yii/base/Module.php b/framework/yii/base/Module.php index 2bc42e3..a85385b 100644 --- a/framework/yii/base/Module.php +++ b/framework/yii/base/Module.php @@ -192,13 +192,7 @@ abstract class Module extends Component */ public function getUniqueId() { - if ($this instanceof Application) { - return ''; - } elseif ($this->module) { - return ltrim($this->module->getUniqueId() . '/' . $this->id, '/'); - } else { - return $this->id; - } + return $this->module ? ltrim($this->module->getUniqueId() . '/' . $this->id, '/') : $this->id; } /**