Update adapter factory interface
This commit is contained in:
@@ -15,11 +15,9 @@ interface AdapterFactoryInterface
|
||||
/**
|
||||
* Creates the adapter, registers it and returns its id
|
||||
*
|
||||
* @param ContainerBuilder $container
|
||||
* @param string $id
|
||||
* @param array $config
|
||||
*
|
||||
* @return string The Adapter service id in the DIC
|
||||
* @param ContainerBuilder $container A ContainerBuilder instance
|
||||
* @param string $id The id of the service
|
||||
* @param array $config An array of configuration
|
||||
*/
|
||||
function create(ContainerBuilder $container, $id, array $config);
|
||||
|
||||
|
||||
@@ -18,14 +18,10 @@ class InMemoryAdapterFactory implements AdapterFactoryInterface
|
||||
*/
|
||||
public function create(ContainerBuilder $container, $id, array $config)
|
||||
{
|
||||
$adapter = sprintf('knplabs_gaufrette.adapter.local.%s', $id);
|
||||
|
||||
$container
|
||||
->setDefinition($adapter, new DefinitionDecorator('knplabs_gaufrette.adapter.in_memory'))
|
||||
->setDefinition($id, new DefinitionDecorator('knplabs_gaufrette.adapter.in_memory'))
|
||||
->replaceArgument(0, $config['files'])
|
||||
;
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,15 +18,11 @@ class LocalAdapterFactory implements AdapterFactoryInterface
|
||||
*/
|
||||
public function create(ContainerBuilder $container, $id, array $config)
|
||||
{
|
||||
$adapter = sprintf('knplabs_gaufrette.adapter.local.%s', $id);
|
||||
|
||||
$container
|
||||
->setDefinition($adapter, new DefinitionDecorator('knplabs_gaufrette.adapter.local'))
|
||||
->setDefinition($id, new DefinitionDecorator('knplabs_gaufrette.adapter.local'))
|
||||
->replaceArgument(0, $config['directory'])
|
||||
->replaceArgument(1, $config['create'])
|
||||
;
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -18,15 +18,11 @@ class SafeLocalAdapterFactory implements AdapterFactoryInterface
|
||||
*/
|
||||
public function create(ContainerBuilder $container, $id, array $config)
|
||||
{
|
||||
$adapter = sprintf('knplabs_gaufrette.adapter.safe_local.%s', $id);
|
||||
|
||||
$container
|
||||
->setDefinition($adapter, new DefinitionDecorator('knplabs_gaufrette.adapter.safe_local'))
|
||||
->setDefinition($id, new DefinitionDecorator('knplabs_gaufrette.adapter.safe_local'))
|
||||
->replaceArgument(0, $config['directory'])
|
||||
->replaceArgument(1, $config['create'])
|
||||
;
|
||||
|
||||
return $adapter;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -17,7 +17,7 @@ class ServiceAdapterFactory implements AdapterFactoryInterface
|
||||
*/
|
||||
public function create(ContainerBuilder $container, $id, array $config)
|
||||
{
|
||||
return $config['id'];
|
||||
$container->setAlias($id, $config['id']);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user