This commit is contained in:
2021-04-25 16:27:04 +08:00
parent c8e46648d3
commit 4b0e457318
+3 -2
View File
@@ -51,8 +51,6 @@ class Service extends Component
} }
throw new ComponentException("Unknown component ID: $id"); throw new ComponentException("Unknown component ID: $id");
} }
$this->_ids[] = $id;
if (isset($this->_definition[$id])) { if (isset($this->_definition[$id])) {
$config = $this->_definition[$id]; $config = $this->_definition[$id];
if (is_object($config)) { if (is_object($config)) {
@@ -88,6 +86,9 @@ class Service extends Component
if ($definition === NULL) { if ($definition === NULL) {
return $this->remove($id); return $this->remove($id);
} }
$this->_ids[] = $id;
unset($this->_components[$id]); unset($this->_components[$id]);
if (is_object($definition) || is_callable($definition, TRUE)) { if (is_object($definition) || is_callable($definition, TRUE)) {
return $this->_definition[$id] = $definition; return $this->_definition[$id] = $definition;