diff --git a/framework/yii/base/Application.php b/framework/yii/base/Application.php index 55258ee..11abfd6 100644 --- a/framework/yii/base/Application.php +++ b/framework/yii/base/Application.php @@ -140,6 +140,11 @@ abstract class Application extends Module $this->registerCoreComponents(); Component::__construct($config); + + $this->preloadComponents(); + if ($this->controllerNamespace === null) { + $this->controllerNamespace = 'app\\controllers'; + } } /** @@ -172,20 +177,6 @@ abstract class Application extends Module } /** - * Initializes the application. - * This method is called after the application is created and initialized with property values - * given in configuration. - */ - public function init() - { - $this->preloadComponents(); - if ($this->controllerNamespace === null) { - $this->controllerNamespace = 'app\\controllers'; - } - } - - - /** * Loads components that are declared in [[preload]]. * @throws InvalidConfigException if a component or module to be preloaded is unknown */ diff --git a/framework/yii/base/Module.php b/framework/yii/base/Module.php index a03fd83..a7aa387 100644 --- a/framework/yii/base/Module.php +++ b/framework/yii/base/Module.php @@ -130,6 +130,12 @@ abstract class Module extends Component $this->id = $id; $this->module = $parent; parent::__construct($config); + if ($this->controllerNamespace === null) { + $class = get_class($this); + if (($pos = strrpos($class, '\\')) !== false) { + $this->controllerNamespace = substr($class, 0, $pos) . '\\controllers'; + } + } } /** @@ -173,12 +179,6 @@ abstract class Module extends Component public function init() { $this->preloadComponents(); - if ($this->controllerNamespace === null) { - $class = get_class($this); - if (($pos = strrpos($class, '\\')) !== false) { - $this->controllerNamespace = substr($class, 0, $pos) . '\\controllers'; - } - } } /**