added Dropbox Adapter Factory
This commit is contained in:
parent
bd695f9194
commit
ae786b1faa
45
DependencyInjection/Factory/DropboxAdapterFactory.php
Normal file
45
DependencyInjection/Factory/DropboxAdapterFactory.php
Normal 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()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
|
@ -47,7 +47,9 @@
|
||||||
<service id="knp_gaufrette.adapter.factory.cache" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\CacheAdapterFactory">
|
<service id="knp_gaufrette.adapter.factory.cache" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\CacheAdapterFactory">
|
||||||
<tag name="gaufrette.adapter.factory" />
|
<tag name="gaufrette.adapter.factory" />
|
||||||
</service>
|
</service>
|
||||||
|
<service id="knp_gaufrette.adapter.factory.dropbox" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\DropboxAdapterFactory">
|
||||||
|
<tag name="gaufrette.adapter.factory" />
|
||||||
|
</service>
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
</container>
|
</container>
|
||||||
|
|
|
@ -46,6 +46,7 @@
|
||||||
<service id="knp_gaufrette.filesystem_map" class="%knp_gaufrette.filesystem_map.class%">
|
<service id="knp_gaufrette.filesystem_map" class="%knp_gaufrette.filesystem_map.class%">
|
||||||
<argument /> <!-- map of filesystems -->
|
<argument /> <!-- map of filesystems -->
|
||||||
</service>
|
</service>
|
||||||
|
<service id="knp_gaufrette.adapter.dropbox" class="Gaufrette\Adapter\Dropbox" abstract="true" public="false" />
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
</container>
|
</container>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user