From 13b828c2d89c8b492642bd269b88884780437885 Mon Sep 17 00:00:00 2001 From: Mikko Tarvainen Date: Tue, 11 Oct 2011 14:40:51 +0300 Subject: [PATCH 1/7] 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 @@ + + + + From 68682f6250f66e0fa804af1664924c6c9bb9a257 Mon Sep 17 00:00:00 2001 From: Mikko Tarvainen Date: Tue, 11 Oct 2011 15:29:12 +0300 Subject: [PATCH 2/7] docs --- README.markdown | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/README.markdown b/README.markdown index 6be0562..600160f 100644 --- a/README.markdown +++ b/README.markdown @@ -260,5 +260,25 @@ services: arguments: [@acme_test.mongodb, %acme_test.gridfs.prefix%] ``` +## MogileFS (mogilefs) + +Allows you to use a mogilefs as an adapter. + +### Parameters + + * `domain` MogileFS domain + * `hosts` Available trackers + +### Example + +``` yaml +# app/config/config.yml +knp_gaufrette: + adapters: + foo: + mogilefs: + domain: foobar + hosts: ["192.168.0.1:7001", "192.168.0.2:7001"] +``` [gaufrette-homepage]: https://github.com/knplabs/Gaufrette From d42d2fe6f8516caf6c11dbbb5cee290f5ca82111 Mon Sep 17 00:00:00 2001 From: Tomi Saarinen Date: Wed, 12 Oct 2011 09:26:48 +0300 Subject: [PATCH 3/7] docs --- README.markdown | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.markdown b/README.markdown index 600160f..3138754 100644 --- a/README.markdown +++ b/README.markdown @@ -221,7 +221,7 @@ knp_gaufrette: ## GridFS (gridfs) -Allows you to use a gridfs as an adapter. +Adapter that allows you to use a MongoDB GridFS for storing files. ### Parameters @@ -262,7 +262,7 @@ services: ## MogileFS (mogilefs) -Allows you to use a mogilefs as an adapter. +Adapter that allows you to use MogileFS for storing files. ### Parameters From 46ac56e5c8f582214953ccc41d4e30c861658696 Mon Sep 17 00:00:00 2001 From: Tomi Saarinen Date: Wed, 12 Oct 2011 09:40:44 +0300 Subject: [PATCH 4/7] docs --- README.markdown | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.markdown b/README.markdown index 3138754..4e49abd 100644 --- a/README.markdown +++ b/README.markdown @@ -260,6 +260,8 @@ services: arguments: [@acme_test.mongodb, %acme_test.gridfs.prefix%] ``` +Please note it is possible to prepare MongoGridFS service anyway you like. This is just one way to do it. + ## MogileFS (mogilefs) Adapter that allows you to use MogileFS for storing files. From a568af692f2f031f96c9a14a5a54966f0a2887aa Mon Sep 17 00:00:00 2001 From: TomiS Date: Wed, 12 Oct 2011 09:47:11 +0300 Subject: [PATCH 5/7] docs --- README.markdown | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.markdown b/README.markdown index 4e49abd..5e7319c 100644 --- a/README.markdown +++ b/README.markdown @@ -260,7 +260,7 @@ services: arguments: [@acme_test.mongodb, %acme_test.gridfs.prefix%] ``` -Please note it is possible to prepare MongoGridFS service anyway you like. This is just one way to do it. +Note that it is possible to prepare MongoGridFS service anyway you like. This is just one way to do it. ## MogileFS (mogilefs) From e06a4839e13bbf438c9ff224a79dd27c9ad14370 Mon Sep 17 00:00:00 2001 From: Mikko Tarvainen Date: Wed, 12 Oct 2011 10:09:43 +0300 Subject: [PATCH 6/7] author --- DependencyInjection/Factory/MogileFSAdapterFactory.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/DependencyInjection/Factory/MogileFSAdapterFactory.php b/DependencyInjection/Factory/MogileFSAdapterFactory.php index 3da456b..1f82ff7 100644 --- a/DependencyInjection/Factory/MogileFSAdapterFactory.php +++ b/DependencyInjection/Factory/MogileFSAdapterFactory.php @@ -10,7 +10,7 @@ use Symfony\Component\DependencyInjection\DefinitionDecorator; /** * GridFS adapter factory * - * @author Mikko Tarvainen + * @author Mikko Tarvainen 2011 */ class MogileFSAdapterFactory implements AdapterFactoryInterface { From 0633cb6ed9767868dc728c7d71a83b2f34061e64 Mon Sep 17 00:00:00 2001 From: Mikko Tarvainen Date: Mon, 17 Oct 2011 16:46:47 +0300 Subject: [PATCH 7/7] Corrected configuration option --- DependencyInjection/Factory/MogileFSAdapterFactory.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DependencyInjection/Factory/MogileFSAdapterFactory.php b/DependencyInjection/Factory/MogileFSAdapterFactory.php index 1f82ff7..19b956b 100644 --- a/DependencyInjection/Factory/MogileFSAdapterFactory.php +++ b/DependencyInjection/Factory/MogileFSAdapterFactory.php @@ -43,7 +43,8 @@ class MogileFSAdapterFactory implements AdapterFactoryInterface ->children() ->scalarNode('domain')->isRequired()->cannotBeEmpty()->end() ->arrayNode('hosts') - ->prototype('scalar')->isRequired()->end() + ->requiresAtLeastOneElement() + ->prototype('scalar')->end() ->end() ->end() ;