bug #28376 [TwigBundle] Fixed caching of templates in src/Resources/<BundleName>/views on cache warmup (yceruto)

This PR was merged into the 2.8 branch.

Discussion
----------

[TwigBundle] Fixed caching of templates in src/Resources/<BundleName>/views on cache warmup

| Q             | A
| ------------- | ---
| Branch?       | 2.8
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Same as https://github.com/symfony/symfony/pull/27764, but in this case the convention is wrong.

Corrected according to:
992a174470/src/Symfony/Bundle/TwigBundle/DependencyInjection/TwigExtension.php (L165)

Commits
-------

83a75f4313 Caching missed templates on cache warmup
This commit is contained in:
Fabien Potencier 2018-09-27 19:44:44 +02:00
commit 2e85ef5259
3 changed files with 2 additions and 1 deletions

View File

@ -57,7 +57,7 @@ class TemplateIterator implements \IteratorAggregate
$this->templates = array_merge(
$this->templates,
$this->findTemplatesInDirectory($bundle->getPath().'/Resources/views', $name),
$this->findTemplatesInDirectory($this->rootDir.'/'.$bundle->getName().'/views', $name)
$this->findTemplatesInDirectory($this->rootDir.'/Resources/'.$bundle->getName().'/views', $name)
);
}

View File

@ -31,6 +31,7 @@ class TemplateIteratorTest extends TestCase
sort($sorted);
$this->assertEquals(
array(
'@Bar/base.html.twig',
'@Bar/index.html.twig',
'@Foo/index.html.twig',
'layout.html.twig',