mirror of
https://github.com/yiisoft/yii2.git
synced 2025-11-02 04:37:42 +08:00
Fix #19030: Add DI container usage to yii\base\Widget::end()
This commit is contained in:
@ -31,6 +31,7 @@ Yii Framework 2 Change Log
|
||||
- Bug #18988: Fix default value of `yii\console\controllers\MessageController::$translator` (WinterSilence)
|
||||
- Bug #18993: Load defaults by `attributes()` in `yii\db\ActiveRecord::loadDefaultValues()` (WinterSilence)
|
||||
- Bug #19021: Fix return type in PhpDoc `yii\db\Migration` functions `up()`, `down()`, `safeUp()` and `safeDown()` (WinterSilence, rhertogh)
|
||||
- Bug #19030: Add DI container usage to `yii\base\Widget::end()` (papppeter)
|
||||
|
||||
|
||||
2.0.43 August 09, 2021
|
||||
|
||||
@ -104,7 +104,13 @@ class Widget extends Component implements ViewContextInterface
|
||||
{
|
||||
if (!empty(self::$stack)) {
|
||||
$widget = array_pop(self::$stack);
|
||||
if (get_class($widget) === get_called_class()) {
|
||||
|
||||
$calledClass = get_called_class();
|
||||
if (Yii::$container->has($calledClass) && isset(Yii::$container->getDefinitions()[$calledClass]['class'])) {
|
||||
$calledClass = Yii::$container->getDefinitions()[$calledClass]['class'];
|
||||
}
|
||||
|
||||
if (get_class($widget) === $calledClass) {
|
||||
/* @var $widget Widget */
|
||||
if ($widget->beforeRun()) {
|
||||
$result = $widget->run();
|
||||
|
||||
Reference in New Issue
Block a user