Commit 8134af0e by Carsten Brandt

allow using errorhandler from the app namespace

fixes #3431
parent 3ea2ffbb
...@@ -309,6 +309,14 @@ abstract class Application extends Module ...@@ -309,6 +309,14 @@ abstract class Application extends Module
echo "Error: no errorHandler component is configured.\n"; echo "Error: no errorHandler component is configured.\n";
exit(1); exit(1);
} }
// allow using ErrorHandler from the app namespace
if (strncmp($config['components']['errorHandler']['class'], 'app\\', 4) === 0) {
if (isset($config['basePath'])) {
Yii::setAlias('@app', $config['basePath']);
} else {
throw new InvalidConfigException('The "basePath" configuration for the Application is required.');
}
}
$this->set('errorHandler', $config['components']['errorHandler']); $this->set('errorHandler', $config['components']['errorHandler']);
unset($config['components']['errorHandler']); unset($config['components']['errorHandler']);
$this->getErrorHandler()->register(); $this->getErrorHandler()->register();
......
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