From 13b828c2d89c8b492642bd269b88884780437885 Mon Sep 17 00:00:00 2001 From: Mikko Tarvainen Date: Tue, 11 Oct 2011 14:40:51 +0300 Subject: [PATCH] MogileFS adapter --- .../Factory/MogileFSAdapterFactory.php | 51 +++++++++++++++++++ Resources/config/adapter_factories.xml | 4 ++ Resources/config/gaufrette.xml | 4 ++ 3 files changed, 59 insertions(+) create mode 100644 DependencyInjection/Factory/MogileFSAdapterFactory.php diff --git a/DependencyInjection/Factory/MogileFSAdapterFactory.php b/DependencyInjection/Factory/MogileFSAdapterFactory.php new file mode 100644 index 0000000..3da456b --- /dev/null +++ b/DependencyInjection/Factory/MogileFSAdapterFactory.php @@ -0,0 +1,51 @@ +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() + ; + } +} diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 3de8c03..08668a9 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -26,6 +26,10 @@ + + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index 6aabbd1..ecb16b8 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -22,6 +22,10 @@ + + + +