[FrameworkBundle] Fix the cache template loader

This commit is contained in:
Victor Berchet 2011-04-02 17:05:02 +02:00
parent 1d4024c654
commit 788ed5126b
5 changed files with 11 additions and 5 deletions

View File

@ -32,6 +32,7 @@ $container->loadFromExtension('framework', array(
'templating' => array(
'assets_version' => 'SomeVersionScheme',
'assets_base_urls' => 'http://cdn.example.com',
'cache' => '/path/to/cache',
'cache_warmer' => true,
'engines' => array('php', 'twig'),
'loader' => array('loader.foo', 'loader.bar'),

View File

@ -12,7 +12,7 @@
<app:profiler only-exceptions="true" />
<app:router cache-warmer="true" resource="%kernel.root_dir%/config/routing.xml" type="xml" />
<app:session auto-start="true" class="Session" default-locale="fr" storage-id="native" name="_SYMFONY" lifetime="86400" path="/" domain="example.com" secure="true" httponly="true" />
<app:templating assets-version="SomeVersionScheme" cache-warmer="true">
<app:templating assets-version="SomeVersionScheme" cache-warmer="true" cache="/path/to/cache" >
<app:loader>loader.foo</app:loader>
<app:loader>loader.bar</app:loader>
<app:engine id="php" />

View File

@ -28,6 +28,7 @@ framework:
cache_warmer: true
engines: [php, twig]
loader: [loader.foo, loader.bar]
cache: /path/to/cache
packages:
images:
version: 1.0.0

View File

@ -113,7 +113,11 @@ abstract class FrameworkExtensionTest extends TestCase
$this->assertEquals('templating.engine.delegating', (string) $container->getAlias('templating'), '->registerTemplatingConfiguration() configures delegating loader if multiple engines are provided');
$this->assertEquals('templating.loader.chain', (string) $container->getAlias('templating.loader'), '->registerTemplatingConfiguration() configures loader chain if multiple loaders are provided');
$this->assertEquals($container->getDefinition('templating.loader.chain'), $container->getDefinition('templating.loader.wrapped'), '->registerTemplatingConfiguration() configures loader chain if multiple loaders are provided');
$this->assertEquals($container->getDefinition('templating.loader'), $container->getDefinition('templating.loader.cache'), '->registerTemplatingConfiguration() configures the loader to use cache');
$this->assertEquals('/path/to/cache', $container->getParameter('templating.loader.cache.path'));
$this->assertEquals(array('php', 'twig'), $container->getParameter('templating.engines'), '->registerTemplatingConfiguration() sets a templating.engines parameter');
}

View File

@ -32,10 +32,10 @@ class CacheLoader extends Loader
/**
* Constructor.
*
* @param Loader $loader A Loader instance
* @param LoaderInterface $loader A Loader instance
* @param string $dir The directory where to store the cache files
*/
public function __construct(Loader $loader, $dir)
public function __construct(LoaderInterface $loader, $dir)
{
$this->loader = $loader;
$this->dir = $dir;