Fixes #14793: Module ->get() and ->has() methods now check parent modules and fall back to application if nothing found

This commit is contained in:
Sam
2017-09-13 00:32:57 +02:00
committed by Alexander Makarov
parent b6b02ff154
commit 04281cba8c
3 changed files with 47 additions and 3 deletions

View File

@@ -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));
}
}