added Dropbox Adapter Factory

This commit is contained in:
Radu Topala 2013-10-04 06:17:52 +00:00
parent bd695f9194
commit ae786b1faa
3 changed files with 49 additions and 1 deletions

View File

@ -0,0 +1,45 @@
<?php
namespace Knp\Bundle\GaufretteBundle\DependencyInjection\Factory;
use Symfony\Component\Config\Definition\Builder\NodeDefinition;
use Symfony\Component\DependencyInjection\Reference;
use Symfony\Component\DependencyInjection\ContainerBuilder;
use Symfony\Component\DependencyInjection\DefinitionDecorator;
/**
* Dropbox Adapter Factory
*/
class DropboxAdapterFactory implements AdapterFactoryInterface
{
/**
* {@inheritDoc}
*/
function create(ContainerBuilder $container, $id, array $config)
{
$container
->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.dropbox'))
->addArgument(new Reference($config['api_id']))
;
}
/**
* {@inheritDoc}
*/
function getKey()
{
return 'dropbox';
}
/**
* {@inheritDoc}
*/
function addConfiguration(NodeDefinition $builder)
{
$builder
->children()
->scalarNode('api_id')->isRequired()->end()
->end()
;
}
}

View File

@ -47,7 +47,9 @@
<service id="knp_gaufrette.adapter.factory.cache" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\CacheAdapterFactory">
<tag name="gaufrette.adapter.factory" />
</service>
<service id="knp_gaufrette.adapter.factory.dropbox" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\DropboxAdapterFactory">
<tag name="gaufrette.adapter.factory" />
</service>
</services>
</container>

View File

@ -46,6 +46,7 @@
<service id="knp_gaufrette.filesystem_map" class="%knp_gaufrette.filesystem_map.class%">
<argument /> <!-- map of filesystems -->
</service>
<service id="knp_gaufrette.adapter.dropbox" class="Gaufrette\Adapter\Dropbox" abstract="true" public="false" />
</services>
</container>