Explorar el Código

tweaked previous commit

Fabien Potencier hace 14 años
padre
commit
a17478ff74

+ 2 - 0
UPDATE.md

@@ -9,6 +9,8 @@ timeline closely anyway.
 beta4 to beta5
 --------------
 
+* All settings regarding the cache warmers have been removed.
+
 * `Response::isRedirected()` has been merged with `Response::isRedirect()`
 
 beta3 to beta4

+ 3 - 3
src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php

@@ -28,12 +28,12 @@ class TemplateLocator implements FileLocatorInterface
     /**
      * Constructor.
      *
-     * @param string               $cacheDir The cache path
      * @param FileLocatorInterface $locator  A FileLocatorInterface instance
+     * @param string               $cacheDir The cache path
      */
-    public function __construct($cacheDir, FileLocatorInterface $locator)
+    public function __construct(FileLocatorInterface $locator, $cacheDir = null)
     {
-        if (file_exists($cache = $cacheDir.'/templates.php')) {
+        if (null !== $cacheDir && file_exists($cache = $cacheDir.'/templates.php')) {
             $this->cache = require $cache;
         }
 

+ 3 - 3
src/Symfony/Bundle/FrameworkBundle/Tests/Templating/Loader/TemplateLocatorTest.php

@@ -30,7 +30,7 @@ class TemplateLocatorTest extends TestCase
             ->will($this->returnValue('/path/to/template'))
         ;
 
-        $locator = new TemplateLocator('', $fileLocator);
+        $locator = new TemplateLocator($fileLocator);
 
         $this->assertEquals('/path/to/template', $locator->locate($template));
     }
@@ -50,7 +50,7 @@ class TemplateLocatorTest extends TestCase
             ->will($this->throwException(new \InvalidArgumentException()))
         ;
 
-        $locator = new TemplateLocator('', $fileLocator);
+        $locator = new TemplateLocator($fileLocator);
 
         $locator->locate($template);
     }
@@ -60,7 +60,7 @@ class TemplateLocatorTest extends TestCase
      */
     public function testThrowsAnExceptionWhenTemplateIsNotATemplateReferenceInterface()
     {
-        $locator = new TemplateLocator('', $this->getFileLocator());
+        $locator = new TemplateLocator($this->getFileLocator());
         $locator->locate('template');
     }