Merge pull request #26 from l3l0/compatibility-with-new-gaufrette-version

Changes allow to KnpGaufretteBundle work with latest Gaufrette
This commit is contained in:
Leszek Prabucki 2012-11-16 00:35:05 -08:00
commit 4370da0ad4
3 changed files with 56 additions and 7 deletions

View File

@ -18,12 +18,16 @@ 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']);
} elseif (isset($config['create'])) {
$definition->addArgument(array('create' => $config['create']));
}
}
/**
@ -47,8 +51,17 @@ class AmazonS3AdapterFactory implements AdapterFactoryInterface
->children()
->scalarNode('amazon_s3_id')->isRequired()->cannotBeEmpty()->end()
->scalarNode('bucket_name')->isRequired()->cannotBeEmpty()->end()
->booleanNode('create')->defaultFalse()->end()
->booleanNode('create')->end()
->arrayNode('options')
->children()
->booleanNode('create')
->defaultFalse()
->end()
->scalarNode('region')->end()
->scalarNode('directory')->end()
->end()
->end()
->end()
;
}
}
}

31
UPGRADE Normal file
View File

@ -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
```

View File

@ -17,7 +17,7 @@
],
"require": {
"symfony/framework-bundle": "2.*",
"knplabs/gaufrette": "0.1.3"
"knplabs/gaufrette": "0.2.*@dev"
},
"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"
}