Update service provider

This commit is contained in:
Romain Neutron
2012-09-21 15:49:52 +02:00
parent b9e92fafff
commit d75b8ee239
5 changed files with 27 additions and 37 deletions

View File

@@ -22,18 +22,17 @@ class BorderManagerServiceProvider implements ServiceProviderInterface
{
$app['border-manager'] = $app->share(function(Application $app) {
$configuration = $app['phraseanet.configuration']
->getService($app['phraseanet.configuration']
->getBorder());
$configuration = $app['phraseanet.configuration']
->getService($app['phraseanet.configuration']
->getBorder());
$service = Builder::create($app, $configuration);
$service = Builder::create($app, $configuration);
return $service->getDriver();
});
return $service->getDriver();
});
}
public function boot(Application $app)
{
}
}

View File

@@ -20,12 +20,11 @@ class BrowserServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['browser'] = $app->share(function($app) {
return new \Browser();
});
return new \Browser();
});
}
public function boot(Application $app)
{
}
}

View File

@@ -20,33 +20,28 @@ class CacheServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['phraseanet.cache-service'] = $app->share(function(Application $app) {
if ( ! file_exists(__DIR__ . '/../../../../../tmp/cache_registry.yml')) {
touch(__DIR__ . '/../../../../../tmp/cache_registry.yml');
}
if ( ! file_exists(__DIR__ . '/../../../../../tmp/cache_registry.yml')) {
touch(__DIR__ . '/../../../../../tmp/cache_registry.yml');
}
return new CacheManager($app, new \SplFileInfo(__DIR__ . '/../../../../../tmp/cache_registry.yml'));
});
return new CacheManager($app, new \SplFileInfo(__DIR__ . '/../../../../../tmp/cache_registry.yml'));
});
$app['cache'] = $app->share(function(Application $app) {
return $app['phraseanet.cache-service']
->get('MainCache', $app['phraseanet.configuration']->getCache())
->getDriver();
});
return $app['phraseanet.cache-service']
->get('MainCache', $app['phraseanet.configuration']->getCache())
->getDriver();
});
$app['opcode-cache'] = $app->share(function(Application $app) {
return $app['phraseanet.cache-service']
->get('OpcodeCache', $app['phraseanet.configuration']->getOpcodeCache())
->getDriver();
});
return $app['phraseanet.cache-service']
->get('OpcodeCache', $app['phraseanet.configuration']->getOpcodeCache())
->getDriver();
});
}
public function boot(Application $app)
{
}
}

View File

@@ -22,7 +22,6 @@ class ConfigurationServiceProvider implements ServiceProviderInterface
public function register(SilexApplication $app)
{
$app['phraseanet.configuration'] = $app->share(function(Application $app) {
return Configuration::build(null, $app->getEnvironment());
});
}

View File

@@ -21,17 +21,15 @@ class ORMServiceProvider implements ServiceProviderInterface
public function register(Application $app)
{
$app['EM'] = $app->share(function(Application $app) {
return Builder::create(
$app, $app['phraseanet.configuration']
->getService($app['phraseanet.configuration']
->getOrm())
)->getDriver();
});
return Builder::create(
$app, $app['phraseanet.configuration']
->getService($app['phraseanet.configuration']
->getOrm())
)->getDriver();
});
}
public function boot(Application $app)
{
}
}