Gush\Factory\AdapterFactory::createRepositoryManager PHP Method

createRepositoryManager() public method

Creates a new RepositoryManager (Adapter object) with the given configuration.
public createRepositoryManager ( string $name, array $adapterConfig, Config $globalConfig ) : Gush\Adapter\Adapter
$name string
$adapterConfig array
$globalConfig Gush\Config
return Gush\Adapter\Adapter
    public function createRepositoryManager($name, array $adapterConfig, Config $globalConfig)
    {
        $factory = $this->getFactoryObject($name);
        if (!$factory instanceof RepositoryManagerFactory) {
            throw new \LogicException(sprintf('Adapter %s does not support repository-management.', $name));
        }
        return $factory->createRepositoryManager($adapterConfig, $globalConfig);
    }

Usage Example

Example #1
0
 public function testCannotCreateUnregisteredAdapter()
 {
     $this->setExpectedException('InvalidArgumentException', 'No Adapter with name "test2" is registered.');
     $this->adapterFactory->createRepositoryManager('test2', [], $this->config);
 }