This commit is contained in:
2020-08-31 14:02:54 +08:00
parent 814e73866e
commit 073dee78b9
2 changed files with 16 additions and 1 deletions
+16
View File
@@ -47,6 +47,22 @@ class Application extends BaseApplication
}
/**
* @param $name
* @param $service
* @return Application
* @throws Exception
*/
public function import(string $name, string $service)
{
$class = $this->set($name, ['class' => $service]);
if (method_exists($class, 'onImport')) {
$class->onImport($this);
}
return $this;
}
/**
* @throws Exception
*/
-1
View File
@@ -76,7 +76,6 @@ class Service extends Component
if ($definition === NULL) {
return $this->remove($id);
}
unset($this->_components[$id]);
if (is_object($definition) || is_callable($definition, TRUE)) {
return $this->_definition[$id] = $definition;