MogileFS adapter
This commit is contained in:
parent
25f1032079
commit
13b828c2d8
51
DependencyInjection/Factory/MogileFSAdapterFactory.php
Normal file
51
DependencyInjection/Factory/MogileFSAdapterFactory.php
Normal file
|
@ -0,0 +1,51 @@
|
||||||
|
<?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;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* GridFS adapter factory
|
||||||
|
*
|
||||||
|
* @author Mikko Tarvainen
|
||||||
|
*/
|
||||||
|
class MogileFSAdapterFactory implements AdapterFactoryInterface
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function create(ContainerBuilder $container, $id, array $config)
|
||||||
|
{
|
||||||
|
$container
|
||||||
|
->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.mogilefs'))
|
||||||
|
->replaceArgument(0, $config['domain'])
|
||||||
|
->replaceArgument(1, $config['hosts'])
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function getKey()
|
||||||
|
{
|
||||||
|
return 'mogilefs';
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* {@inheritDoc}
|
||||||
|
*/
|
||||||
|
public function addConfiguration(NodeDefinition $node)
|
||||||
|
{
|
||||||
|
$node
|
||||||
|
->children()
|
||||||
|
->scalarNode('domain')->isRequired()->cannotBeEmpty()->end()
|
||||||
|
->arrayNode('hosts')
|
||||||
|
->prototype('scalar')->isRequired()->end()
|
||||||
|
->end()
|
||||||
|
->end()
|
||||||
|
;
|
||||||
|
}
|
||||||
|
}
|
|
@ -26,6 +26,10 @@
|
||||||
<service id="knp_gaufrette.adapter.factory.gridfs" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\GridFSAdapterFactory">
|
<service id="knp_gaufrette.adapter.factory.gridfs" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\GridFSAdapterFactory">
|
||||||
<tag name="gaufrette.adapter.factory" />
|
<tag name="gaufrette.adapter.factory" />
|
||||||
</service>
|
</service>
|
||||||
|
<service id="knp_gaufrette.adapter.factory.mogilefs" class="Knp\Bundle\GaufretteBundle\DependencyInjection\Factory\MogileFSAdapterFactory">
|
||||||
|
<tag name="gaufrette.adapter.factory" />
|
||||||
|
</service>
|
||||||
|
|
||||||
</services>
|
</services>
|
||||||
|
|
||||||
</container>
|
</container>
|
||||||
|
|
|
@ -22,6 +22,10 @@
|
||||||
<service id="knp_gaufrette.adapter.amazon_s3" class="Gaufrette\Adapter\AmazonS3" abstract="true" public="false" />
|
<service id="knp_gaufrette.adapter.amazon_s3" class="Gaufrette\Adapter\AmazonS3" abstract="true" public="false" />
|
||||||
<service id="knp_gaufrette.adapter.acl_aware_amazon_s3" class="Gaufrette\Adapter\AclAwareAmazonS3" abstract="true" public="false" />
|
<service id="knp_gaufrette.adapter.acl_aware_amazon_s3" class="Gaufrette\Adapter\AclAwareAmazonS3" abstract="true" public="false" />
|
||||||
<service id="knp_gaufrette.adapter.gridfs" class="Gaufrette\Adapter\GridFS" abstract="true" public="false" />
|
<service id="knp_gaufrette.adapter.gridfs" class="Gaufrette\Adapter\GridFS" abstract="true" public="false" />
|
||||||
|
<service id="knp_gaufrette.adapter.mogilefs" class="Gaufrette\Adapter\MogileFS" abstract="true" public="false">
|
||||||
|
<argument /><!-- domain -->
|
||||||
|
<argument /><!-- hosts -->
|
||||||
|
</service>
|
||||||
<service id="knp_gaufrette.filesystem_map" class="Knp\Bundle\GaufretteBundle\FilesystemMap">
|
<service id="knp_gaufrette.filesystem_map" class="Knp\Bundle\GaufretteBundle\FilesystemMap">
|
||||||
<argument /> <!-- map of filesystems -->
|
<argument /> <!-- map of filesystems -->
|
||||||
</service>
|
</service>
|
||||||
|
|
Loading…
Reference in New Issue
Block a user