From db25e67b106ef3dcded4ef2f05f4095878d939d3 Mon Sep 17 00:00:00 2001 From: Patrik Karisch Date: Sat, 1 Nov 2014 11:28:57 +0100 Subject: [PATCH] Add support for Google Cloud Storage --- .../GoogleCloudStorageAdapterFactory.php | 55 +++++++++++++++++++ Resources/config/adapter_factories.xml | 3 + Resources/config/gaufrette.xml | 1 + 3 files changed, 59 insertions(+) create mode 100644 DependencyInjection/Factory/GoogleCloudStorageAdapterFactory.php diff --git a/DependencyInjection/Factory/GoogleCloudStorageAdapterFactory.php b/DependencyInjection/Factory/GoogleCloudStorageAdapterFactory.php new file mode 100644 index 0000000..9d47ae1 --- /dev/null +++ b/DependencyInjection/Factory/GoogleCloudStorageAdapterFactory.php @@ -0,0 +1,55 @@ +setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.google_cloud_storage')) + ->addArgument(new Reference($config['service_id'])) + ->addArgument($config['bucket_name']) + ->addArgument($config['options']) + ->addArgument($config['detect_content_type']) + ; + } + + /** + * {@inheritDoc} + */ + public function getKey() + { + return 'google_cloud_storage'; + } + + /** + * {@inheritDoc} + */ + public function addConfiguration(NodeDefinition $builder) + { + $builder + ->children() + ->scalarNode('service_id')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end() + ->booleanNode('detect_content_type')->defaultTrue()->end() + ->arrayNode('options') + ->addDefaultsIfNotSet() + ->children() + ->scalarNode('directory')->defaultValue('')->end() + ->scalarNode('acl')->defaultValue('private')->end() + ->end() + ->end() + ->end() + ; + } +} diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 562a144..1099be5 100644 --- a/Resources/config/adapter_factories.xml +++ b/Resources/config/adapter_factories.xml @@ -35,6 +35,9 @@ + + + diff --git a/Resources/config/gaufrette.xml b/Resources/config/gaufrette.xml index 49041e4..160a6cf 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -33,6 +33,7 @@ +