From f27138e80b5f1d47f57d1225f29a3c22a468cc65 Mon Sep 17 00:00:00 2001 From: l3l0 Date: Wed, 14 Nov 2012 15:36:59 +0100 Subject: [PATCH 1/3] Replace AmazonS3 create boolean param with array one. Changed composer.json --- .../Factory/AmazonS3AdapterFactory.php | 22 ++++++++++++++----- composer.json | 7 +++++- 2 files changed, 22 insertions(+), 7 deletions(-) diff --git a/DependencyInjection/Factory/AmazonS3AdapterFactory.php b/DependencyInjection/Factory/AmazonS3AdapterFactory.php index f583d7b..b6d6467 100644 --- a/DependencyInjection/Factory/AmazonS3AdapterFactory.php +++ b/DependencyInjection/Factory/AmazonS3AdapterFactory.php @@ -18,12 +18,14 @@ class AmazonS3AdapterFactory implements AdapterFactoryInterface */ public function create(ContainerBuilder $container, $id, array $config) { - $container + $definition = $container ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.amazon_s3')) ->addArgument(new Reference($config['amazon_s3_id'])) - ->addArgument($config['bucket_name']) - ->addArgument($config['create']) - ; + ->addArgument($config['bucket_name']); + + if (isset($config['options'])) { + $definition->addArgument($config['options']); + } } /** @@ -47,8 +49,16 @@ class AmazonS3AdapterFactory implements AdapterFactoryInterface ->children() ->scalarNode('amazon_s3_id')->isRequired()->cannotBeEmpty()->end() ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end() - ->booleanNode('create')->defaultFalse()->end() + ->arrayNode('options') + ->children() + ->booleanNode('create') + ->defaultFalse() + ->end() + ->scalarNode('region')->end() + ->scalarNode('directory')->end() + ->end() + ->end() ->end() ; } -} \ No newline at end of file +} diff --git a/composer.json b/composer.json index cfce48c..3ffece0 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "symfony/framework-bundle": "2.*", - "knplabs/gaufrette": "0.1.3" + "knplabs/gaufrette": "*" }, "require-dev": { "symfony/yaml": "2.*", @@ -28,5 +28,10 @@ "Knp\\Bundle\\GaufretteBundle": "" } }, + "extra": { + "branch-alias": { + "dev-master": "0.2.x-dev" + } + }, "target-dir": "Knp/Bundle/GaufretteBundle" } From 503e2899c02743e509e7e06a8049fcf96839274b Mon Sep 17 00:00:00 2001 From: l3l0 Date: Wed, 14 Nov 2012 15:40:17 +0100 Subject: [PATCH 2/3] Changed version og Gaufrette used by bundle. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 3ffece0..144d565 100644 --- a/composer.json +++ b/composer.json @@ -17,7 +17,7 @@ ], "require": { "symfony/framework-bundle": "2.*", - "knplabs/gaufrette": "*" + "knplabs/gaufrette": "0.2.*@dev" }, "require-dev": { "symfony/yaml": "2.*", From 6f5bb2a78a790d422e42148aa8024d9862f48779 Mon Sep 17 00:00:00 2001 From: l3l0 Date: Fri, 16 Nov 2012 09:30:13 +0100 Subject: [PATCH 3/3] Make amazons3 config to be BC. Added UPGRADE file --- .../Factory/AmazonS3AdapterFactory.php | 3 ++ UPGRADE | 31 +++++++++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 UPGRADE diff --git a/DependencyInjection/Factory/AmazonS3AdapterFactory.php b/DependencyInjection/Factory/AmazonS3AdapterFactory.php index b6d6467..1907ab4 100644 --- a/DependencyInjection/Factory/AmazonS3AdapterFactory.php +++ b/DependencyInjection/Factory/AmazonS3AdapterFactory.php @@ -25,6 +25,8 @@ class AmazonS3AdapterFactory implements AdapterFactoryInterface if (isset($config['options'])) { $definition->addArgument($config['options']); + } elseif (isset($config['create'])) { + $definition->addArgument(array('create' => $config['create'])); } } @@ -49,6 +51,7 @@ class AmazonS3AdapterFactory implements AdapterFactoryInterface ->children() ->scalarNode('amazon_s3_id')->isRequired()->cannotBeEmpty()->end() ->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end() + ->booleanNode('create')->end() ->arrayNode('options') ->children() ->booleanNode('create') diff --git a/UPGRADE b/UPGRADE new file mode 100644 index 0000000..fdb3bdc --- /dev/null +++ b/UPGRADE @@ -0,0 +1,31 @@ +UPGRADE FROM 0.1 to 0.2 +======================= + +### AmazonS3 + +* In 0.2 we pass additional options for AmazonS3 Gaufrette provider AmazonS3 config was changed (old way is DEPRECIATED) + +before: + +```yml +knp_gaufrette: + adapters: + adaptername: + amazon_s3: + amazon_s3_id: amazon_s3.service.id + bucket_name: mybucketname + create: true +``` + +after: + +```yml +knp_gaufrette: + adapters: + adaptername: + amazon_s3: + amazon_s3_id: amazon_s3.service.id + bucket_name: mybucketname + options: + create: true +```