From d547add0788f3bee489c54a8c2642a90343e4cc2 Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Thu, 1 Mar 2012 17:13:11 +0100 Subject: [PATCH 1/4] CacheAdapterFactory created --- .../Factory/CacheAdapterFactory.php | 51 +++++++++++++++++++ Resources/config/adapter_factories.xml | 3 ++ Resources/config/gaufrette.xml | 1 + 3 files changed, 55 insertions(+) create mode 100644 DependencyInjection/Factory/CacheAdapterFactory.php diff --git a/DependencyInjection/Factory/CacheAdapterFactory.php b/DependencyInjection/Factory/CacheAdapterFactory.php new file mode 100644 index 0000000..a07654a --- /dev/null +++ b/DependencyInjection/Factory/CacheAdapterFactory.php @@ -0,0 +1,51 @@ + + */ +class CacheAdapterFactory implements AdapterFactoryInterface +{ + /** + * {@inheritDoc} + */ + public function create(ContainerBuilder $container, $id, array $config) + { + $container + ->setDefinition($id, new DefinitionDecorator('knp_gaufrette.adapter.cache')) + ->addArgument(new Reference('gaufrette.' . $config['source'] . '_adapter')) + ->addArgument(new Reference('gaufrette.' . $config['cache'] . '_adapter')) + ->addArgument($config['ttl']) + ; + } + + /** + * {@inheritDoc} + */ + public function getKey() + { + return 'cache'; + } + + /** + * {@inheritDoc} + */ + public function addConfiguration(NodeDefinition $node) + { + $node + ->children() + ->scalarNode('source')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('cache')->isRequired()->cannotBeEmpty()->end() + ->scalarNode('ttl')->defaultValue(0)->end() + ->end() + ; + } +} diff --git a/Resources/config/adapter_factories.xml b/Resources/config/adapter_factories.xml index 6adc9b2..4d52403 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 c901c08..20f3313 100644 --- a/Resources/config/gaufrette.xml +++ b/Resources/config/gaufrette.xml @@ -31,6 +31,7 @@ + From 70d74ebe1160be2fb16c507d9615ed7537edf055 Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Thu, 1 Mar 2012 17:35:36 +0100 Subject: [PATCH 2/4] You can now also set the serialize cache class --- DependencyInjection/Factory/CacheAdapterFactory.php | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DependencyInjection/Factory/CacheAdapterFactory.php b/DependencyInjection/Factory/CacheAdapterFactory.php index a07654a..f606512 100644 --- a/DependencyInjection/Factory/CacheAdapterFactory.php +++ b/DependencyInjection/Factory/CacheAdapterFactory.php @@ -24,6 +24,7 @@ class CacheAdapterFactory implements AdapterFactoryInterface ->addArgument(new Reference('gaufrette.' . $config['source'] . '_adapter')) ->addArgument(new Reference('gaufrette.' . $config['cache'] . '_adapter')) ->addArgument($config['ttl']) + ->addArgument($config['serialize'] ? new Reference('gaufrette.' . $config['serialize'] . '_adapter') : null) ; } @@ -45,6 +46,7 @@ class CacheAdapterFactory implements AdapterFactoryInterface ->scalarNode('source')->isRequired()->cannotBeEmpty()->end() ->scalarNode('cache')->isRequired()->cannotBeEmpty()->end() ->scalarNode('ttl')->defaultValue(0)->end() + ->scalarNode('serialize')->defaultNull()->end() ->end() ; } From 3de89038d9c9d376be7dcf8d95f88be832e612b9 Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Fri, 2 Mar 2012 10:12:56 +0100 Subject: [PATCH 3/4] Otherwise composer will check for the original package. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 263386b..1f5f3a4 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "knplabs/knp-gaufrette-bundle", + "name": "rvdv/knp-gaufrette-bundle", "type": "symfony-bundle", "description": "Allows to easily use the Gaufrette library in a Symfony project", "keywords": ["file", "filesystem", "media", "abstraction"], From 3a80615cac9428c7032a18aabfc708fc508ee9df Mon Sep 17 00:00:00 2001 From: Robin van der Vleuten Date: Wed, 13 Jun 2012 12:42:33 +0300 Subject: [PATCH 4/4] Changed the name to the correct one. --- composer.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/composer.json b/composer.json index 1f5f3a4..263386b 100644 --- a/composer.json +++ b/composer.json @@ -1,5 +1,5 @@ { - "name": "rvdv/knp-gaufrette-bundle", + "name": "knplabs/knp-gaufrette-bundle", "type": "symfony-bundle", "description": "Allows to easily use the Gaufrette library in a Symfony project", "keywords": ["file", "filesystem", "media", "abstraction"],