mirror of
https://github.com/yiisoft/yii2.git
synced 2025-12-19 07:07:58 +08:00
Fixes #14793: Module ->get() and ->has() methods now check parent modules and fall back to application if nothing found
This commit is contained in:
@@ -713,7 +713,8 @@ class Module extends ServiceLocator
|
||||
}
|
||||
|
||||
/**
|
||||
* @inheritdoc
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Since version 2.0.13, if a component isn't defined in the module, it will be looked up in the parent module.
|
||||
* The parent module may be the application.
|
||||
*/
|
||||
@@ -729,4 +730,15 @@ class Module extends ServiceLocator
|
||||
}
|
||||
return $component;
|
||||
}
|
||||
|
||||
/**
|
||||
* {@inheritdoc}
|
||||
*
|
||||
* Since version 2.0.13, if a component isn't defined in the module, it will be looked up in the parent module.
|
||||
* The parent module may be the application.
|
||||
*/
|
||||
public function has($id, $checkInstance = false)
|
||||
{
|
||||
return parent::has($id, $checkInstance) || (isset($this->module) && $this->module->has($id, $checkInstance));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user