Browse Source

Moved setting controllerNamespace back to init

tags/2.0.0-beta
Alexander Makarov 11 years ago
parent
commit
8e1199b0f6
  1. 14
      framework/yii/base/Module.php

14
framework/yii/base/Module.php

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

Loading…
Cancel
Save