src/PHPDish/Bundle/ThemeBundle/CacheWarmer/TemplateFinder.php
private function findTemplatesInBundle(BundleInterface $bundle)
    {
        $name = $bundle->getName();
        $templates = array_merge(
            $this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
            $this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
        );
        //追踪主题下的模板
        foreach ($this->themes as $theme) {
            $templates = array_merge($templates,
                $this->findTemplatesInFolder($this->themeDir.'/'.$name.'/views')
            );
        }
        $templates = array_unique($templates);

        foreach ($templates as $i => $template) {
            $templates[$i] = $template->set('bundle', $name);
        }

        return $templates;
    }
private function findTemplatesInBundle(BundleInterface $bundle)
    {
        $name = $bundle->getName();
        $templates = array_merge(
            $this->findTemplatesInFolder($bundle->getPath().'/Resources/views'),
            $this->findTemplatesInFolder($this->rootDir.'/'.$name.'/views')
        );
        //追踪主题下的模板
        foreach ($this->themes as $theme) {
            $templates = array_merge($templates,
                $this->findTemplatesInFolder($this->themeDir.'/'.$name.'/views')
            );
        }
        $templates = array_unique($templates);

        foreach ($templates as $i => $template) {
            $templates[$i] = $template->set('bundle', $name);
        }

        return $templates;
    }
Find templates in the given bundle.

@param BundleInterface $bundle The bundle where to look for templates

@return TemplateReferenceInterface[]