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; } /**