Commit 8e1199b0 by Alexander Makarov

Moved setting controllerNamespace back to init

parent 9434cc8f
...@@ -126,15 +126,9 @@ abstract class Module extends Component ...@@ -126,15 +126,9 @@ abstract class Module extends Component
*/ */
public function __construct($id, $parent = null, $config = []) public function __construct($id, $parent = null, $config = [])
{ {
parent::__construct($config);
$this->id = $id; $this->id = $id;
$this->module = $parent; $this->module = $parent;
if ($this->controllerNamespace === null) { parent::__construct($config);
$class = get_class($this);
if (($pos = strrpos($class, '\\')) !== false) {
$this->controllerNamespace = substr($class, 0, $pos) . '\\controllers';
}
}
} }
/** /**
...@@ -178,6 +172,12 @@ abstract class Module extends Component ...@@ -178,6 +172,12 @@ abstract class Module extends Component
public function init() public function init()
{ {
$this->preloadComponents(); $this->preloadComponents();
if ($this->controllerNamespace === null) {
$class = get_class($this);
if (($pos = strrpos($class, '\\')) !== false) {
$this->controllerNamespace = substr($class, 0, $pos) . '\\controllers';
}
}
} }
/** /**
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment