diff --git a/src/com_jjcbs/lib/annotation/Autowired.php b/src/com_jjcbs/lib/annotation/Autowired.php index 217ca33..334efc5 100644 --- a/src/com_jjcbs/lib/annotation/Autowired.php +++ b/src/com_jjcbs/lib/annotation/Autowired.php @@ -45,7 +45,6 @@ static protected function do() $property->setAccessible(true); $val = $property->getValue($obj); if (empty($val)) return ''; - static::useNamespace('com_jjcbs\\lib\\ServiceFactory'); static::useNamespace($val); //check is service $ref = new \ReflectionClass($val); @@ -54,6 +53,7 @@ static protected function do() PHP; if ($parent = $ref->getParentClass()) { if ( $parent->getName() == 'service'){ + static::useNamespace('com_jjcbs\\lib\\ServiceFactory'); $tpl = <<%s = ServiceFactory::getInstance(%s::class); EOT;