Skip to content

Commit

Permalink
when creating an instance with a particular registry, also check for …
Browse files Browse the repository at this point in the history
…fulfilling instances (fixes #8)
  • Loading branch information
filecage committed Aug 13, 2018
1 parent 7620e52 commit e26a5fa
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/Creation.php
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ function create () {
*/
private function createInstanceWithRegistry (string $className, Creatable $creatable, ResourceRegistry $registry) {
// Does the registry already contain the resource?
$instance = $registry->getClassResource($className);
$instance = $registry->getClassResource($className) ?? $registry->findFulfillingInstance($creatable);
if ($instance !== null) {
return $instance;
}
Expand Down

0 comments on commit e26a5fa

Please sign in to comment.