Skip to content

Commit d8d2a92

Browse files
authored
Merge pull request #5 from Rarst/silex-v2
Updated for Silex v2
2 parents 6ad4ffb + 4174bce commit d8d2a92

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
],
1414
"require": {
1515
"php": ">=5.3.3",
16-
"silex/silex": "~1.0",
16+
"silex/silex": "^2.0",
1717
"doctrine/cache": "~1.0"
1818
},
1919
"minimum-stability": "dev",

lib/CHH/Silex/CacheServiceProvider.php

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,14 @@
22

33
namespace CHH\Silex;
44

5-
use Silex\Application;
6-
use Silex\ServiceProviderInterface;
5+
use Pimple\Container;
6+
use Pimple\ServiceProviderInterface;
77
use Doctrine\Common\Cache\Cache;
88
use CHH\Silex\CacheServiceProvider\CacheNamespace;
99

1010
class CacheServiceProvider implements ServiceProviderInterface
1111
{
12-
function register(Application $app)
12+
function register(Container $app)
1313
{
1414
$app['cache.factory'] = $app->protect(function($options) {
1515
return function() use ($options) {
@@ -89,23 +89,19 @@ function register(Application $app)
8989
};
9090
});
9191

92-
$app['cache'] = $app->share(function($app) {
92+
$app['cache'] = function($app) {
9393
$factory = $app['cache.factory']($app['cache.options']['default']);
9494
return $factory();
95-
});
95+
};
9696

97-
$app['caches'] = $app->share(function($app) {
98-
$caches = new \Pimple;
97+
$app['caches'] = function($app) {
98+
$caches = new Container;
9999

100100
foreach ($app['cache.options'] as $cache => $options) {
101-
$caches[$cache] = $app->share($app['cache.factory']($options));
101+
$caches[$cache] = $app['cache.factory']($options);
102102
}
103103

104104
return $caches;
105-
});
106-
}
107-
108-
function boot(Application $app)
109-
{
105+
};
110106
}
111107
}

0 commit comments

Comments
 (0)