mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-19 16:01:57 +08:00
Moved Application::$controllerNamespace init into variable declaration, reordered Module::__construct.
This commit is contained in:
@@ -54,6 +54,13 @@ abstract class Application extends Module
|
||||
* @event ActionEvent an event raised after executing a controller action.
|
||||
*/
|
||||
const EVENT_AFTER_ACTION = 'afterAction';
|
||||
|
||||
/**
|
||||
* @var string the namespace that controller classes are in. If not set,
|
||||
* it will use the "app\controllers" namespace.
|
||||
*/
|
||||
public $controllerNamespace = 'app\\controllers';
|
||||
|
||||
/**
|
||||
* @var string the application name.
|
||||
*/
|
||||
@@ -140,10 +147,6 @@ abstract class Application extends Module
|
||||
$this->registerCoreComponents();
|
||||
|
||||
Component::__construct($config);
|
||||
|
||||
if ($this->controllerNamespace === null) {
|
||||
$this->controllerNamespace = 'app\\controllers';
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -83,7 +83,6 @@ abstract class Module extends Component
|
||||
* it will use the "controllers" sub-namespace under the namespace of this module.
|
||||
* For example, if the namespace of this module is "foo\bar", then the default
|
||||
* controller namespace would be "foo\bar\controllers".
|
||||
* If the module is an application, it will default to "app\controllers".
|
||||
*/
|
||||
public $controllerNamespace;
|
||||
/**
|
||||
@@ -127,9 +126,9 @@ abstract class Module extends Component
|
||||
*/
|
||||
public function __construct($id, $parent = null, $config = [])
|
||||
{
|
||||
parent::__construct($config);
|
||||
$this->id = $id;
|
||||
$this->module = $parent;
|
||||
parent::__construct($config);
|
||||
if ($this->controllerNamespace === null) {
|
||||
$class = get_class($this);
|
||||
if (($pos = strrpos($class, '\\')) !== false) {
|
||||
|
||||
Reference in New Issue
Block a user