Implemented Container::setDependencies(), Container::setDefinitions

Closes #11758
Closes #13029
This commit is contained in:
SilverFire - Dmitry Naumenko
2016-11-17 12:32:10 +02:00
parent c17766181f
commit 437825be70
7 changed files with 353 additions and 9 deletions

View File

@ -246,6 +246,12 @@ abstract class Application extends Module
$this->setTimeZone('UTC');
}
if (isset($config['container'])) {
$this->setContainer($config['container']);
unset($config['container']);
}
// merge core components with custom components
foreach ($this->coreComponents() as $id => $component) {
if (!isset($config['components'][$id])) {
@ -652,4 +658,15 @@ abstract class Application extends Module
exit($status);
}
}
/**
* Configures [[Yii::$container]] with the $config
*
* @param array $config values given in terms of name-value pairs
* @since 2.0.11
*/
public function setContainer($config)
{
Yii::configure(Yii::$container, $config);
}
}