Commit f48a7aed by Qiang Xue

Fixes #3251: controller should be created using DI container.

parent 0a860919
...@@ -531,7 +531,7 @@ class Module extends ServiceLocator ...@@ -531,7 +531,7 @@ class Module extends ServiceLocator
} }
if (is_subclass_of($className, 'yii\base\Controller')) { if (is_subclass_of($className, 'yii\base\Controller')) {
return new $className($id, $this); return Yii::createObject($className, [$id, $this]);
} elseif (YII_DEBUG) { } elseif (YII_DEBUG) {
throw new InvalidConfigException("Controller class must extend from \\yii\\base\\Controller."); throw new InvalidConfigException("Controller class must extend from \\yii\\base\\Controller.");
} else { } else {
......
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