Skip to content

Commit

Permalink
Fix creation of new object when instance already exists
Browse files Browse the repository at this point in the history
  • Loading branch information
Zheness authored Jan 2, 2019
1 parent 965154e commit e5e6f64
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/Mouf/MoufManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -641,7 +641,11 @@ private function instantiateComponent($instanceName) {
throw new MoufException("Unknown parameter type ".$constructorParameterDefinition['parametertype']." for parameter in constructor of instance '".$instanceName."'");
}
}
$object = $classDescriptor->newInstanceArgs($constructorParameters);
if (!isset($this->objectInstances[$instanceName])) {
$object = $classDescriptor->newInstanceArgs($constructorParameters);
} else {
$object = $this->objectInstances[$instanceName];
}
} else {
$object = new $className();
}
Expand Down

0 comments on commit e5e6f64

Please sign in to comment.