Merge pull request #15347 from KoJIT2009/di-support-instance-by-property-and-setters

di-support-instance-for-property
This commit is contained in:
Dmitry Naumenko
2017-12-18 22:31:22 +02:00
committed by GitHub
5 changed files with 82 additions and 0 deletions

View File

@ -34,6 +34,7 @@ Yii Framework 2 Change Log
- Enh #15221: Improved the `help/list-action-options` console command output for command options without a description (brandonkelly)
- Enh #15332: Always check for availability of `openssl_pseudo_random_bytes`, even if LibreSSL is available (sammousa)
- Enh #15335: Added `FileHelper::unlink()` that works well under all OSes (samdark)
- Enh #15347: Add `Instance` support for object property in DI container (kojit2009)
- Enh #15340: Test CHANGELOG.md for valid format (sammousa)
- Enh #15360: Refactored `BaseConsole::updateProgress()` (developeruz)
- Bug #15317: Regenerate CSRF token if an empty value is given (sammousa)

View File

@ -375,6 +375,8 @@ class Container extends Component
return $reflection->newInstanceArgs($dependencies);
}
$config = $this->resolveDependencies($config);
if (!empty($dependencies) && $reflection->implementsInterface('yii\base\Configurable')) {
// set $config as the last parameter (existing one will be overwritten)
$dependencies[count($dependencies) - 1] = $config;