ResourceFactory: Add function create(<name>)
The ConfigAwareFactory is an interface forcing "backend-type" classes to call ResourceFactory::createResource() passing a config they got in the constructor. That's kind of overdesigned, if the ResourceFactory wants to be something like a service locator it's responsabilities should include object instantiation. refs #5514
This commit is contained in:
parent
35d11bd145
commit
9d0037a53a
|
@ -132,4 +132,15 @@ class ResourceFactory implements ConfigAwareFactory
|
|||
}
|
||||
return $resource;
|
||||
}
|
||||
|
||||
/**
|
||||
* Create a resource from name
|
||||
*
|
||||
* @param string $resourceName
|
||||
* @return DbConnection|LdapConnection|LivestatusConnection|StatusdatReader
|
||||
*/
|
||||
public static function create($resourceName)
|
||||
{
|
||||
return self::createResource(self::getResourceConfig($resourceName));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue