From cadfc3c50ffaf3780cbbe84397412d0d2b4a0923 Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 2 May 2012 16:49:48 -0500 Subject: [PATCH] Fix IoC bug. --- laravel/ioc.php | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/laravel/ioc.php b/laravel/ioc.php index 30bd0bf9..e752635a 100644 --- a/laravel/ioc.php +++ b/laravel/ioc.php @@ -97,7 +97,17 @@ public static function resolve($type, $parameters = array()) return static::$singletons[$type]; } - $concrete = array_get(static::$registry, "{$type}.resolver", $type); + // If we don't have a registered resolver or concrete for the type, we'll just + // assume the type is the concrete name and will attempt to resolve it as is + // since the container should be able to resolve concretes automatically. + if ( ! isset(static::$registry[$type])) + { + $concrete = $type; + } + else + { + $concrete = array_get(static::$registry[$type], 'resolver', $type); + } // We're ready to instantiate an instance of the concrete type registered for // the binding. This will instantiate the type, as well as resolve any of