Twig/Loader/FilesystemLoader.php
protected function findTemplate($template, $throw = true)
    {
        // Set list of themes, otherwise generate error when clearing cache warmup
        $this->activeTheme->setThemes(array_keys($this->kernel->getThemes()));

        // Set active theme from database/settings
        if ($name = $this->settingsRouter->get('theme')) {
            $this->activeTheme->setName($name);
        }

        return parent::findTemplate($template, $throw);
    }
protected function findTemplate($template, $throw = true)
    {
        // Set list of themes, otherwise generate error when clearing cache warmup
        $this->activeTheme->setThemes(array_keys($this->kernel->getThemes()));

        // Set active theme from database/settings
        if ($name = $this->settingsRouter->get('theme')) {
            $this->activeTheme->setName($name);
        }

        return parent::findTemplate($template, $throw);
    }
Returns the path to the template file.
The file locator is used to locate the template when the naming convention
is the symfony one (i.e. the name can be parsed).
Otherwise the template is located using the locator from the twig library.

@param string|TemplateReferenceInterface $template The template
@param bool                              $throw    When true, a \Twig_Error_Loader exception will be thrown if a
template could not be found

@return string The path to the template file
@throws \Twig_Error_Loader if the template could not be found