diff --git a/DependencyInjection/Factory/GridFSAdapterFactory.php b/DependencyInjection/Factory/GridFSAdapterFactory.php new file mode 100644 index 0000000..b310562 --- /dev/null +++ b/DependencyInjection/Factory/GridFSAdapterFactory.php @@ -0,0 +1,47 @@ + + */ +class GridFSAdapterFactory implements AdapterFactoryInterface +{ + /** + * {@inheritDoc} + */ + public function create(ContainerBuilder $container, $id, array $config) + { + $container + ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.gridfs')) + ->addArgument(new Reference($config['mongogridfs_id'])) + ; + } + + /** + * {@inheritDoc} + */ + public function getKey() + { + return 'gridfs'; + } + + /** + * {@inheritDoc} + */ + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('mongogridfs_id')->isRequired()->cannotBeEmpty()->end() + ->end() + ; + } +} diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 449b21a..3de8c03 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -23,6 +23,9 @@ + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index 2d9b800..6aabbd1 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -21,6 +21,7 @@ +