src/Twig/Loader/DoctrineLoader.php
protected function findTemplate($name)
    {
        if (!$this->isLoadableTemplate($name)) {
            throw new \Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "%stemplate_name").', $name, $this->prefix));
        }

        $templateIdentifier = substr($name, strlen($this->prefix));
        $template = $this->repository->find($templateIdentifier);
        if ($template === null) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }
        if (!($template instanceof TemplateInterface)) {
            throw new \Twig_Error_Loader(sprintf('Unexpected template type "%s" found for template "%s".', get_class($template), $name));
        }
        if ($template instanceof TranslatableTemplateInterface) {
            /** @var TranslatableTemplateInterface $template */
            $locale = $this->getCurrentLocale();
            $template->setCurrentLocale($locale);
        }

        return $template;
    }
protected function findTemplate($name)
    {
        if (!$this->isLoadableTemplate($name)) {
            throw new \Twig_Error_Loader(sprintf('Malformed namespaced template name "%s" (expecting "%stemplate_name").', $name, $this->prefix));
        }

        $templateIdentifier = substr($name, strlen($this->prefix));
        $template = $this->repository->find($templateIdentifier);
        if ($template === null) {
            throw new \Twig_Error_Loader(sprintf('Unable to find template "%s".', $name));
        }
        if (!($template instanceof TemplateInterface)) {
            throw new \Twig_Error_Loader(sprintf('Unexpected template type "%s" found for template "%s".', get_class($template), $name));
        }
        if ($template instanceof TranslatableTemplateInterface) {
            /** @var TranslatableTemplateInterface $template */
            $locale = $this->getCurrentLocale();
            $template->setCurrentLocale($locale);
        }

        return $template;
    }
protected function findTemplate ( $ name ) { if ( ! $ this -> isLoadableTemplate ( $ name ) ) { throw new \ Twig_Error_Loader ( sprintf ( 'Malformed namespaced template name "%s" (expecting "%stemplate_name").' , $ name , $ this -> prefix ) ) ; } $ templateIdentifier = substr ( $ name , strlen ( $ this -> prefix ) ) ; $ template = $ this -> repository -> find ( $ templateIdentifier ) ; if ( $ template === null ) { throw new \ Twig_Error_Loader ( sprintf ( 'Unable to find template "%s".' , $ name ) ) ; } if ( ! ( $ template instanceof TemplateInterface ) ) { throw new \ Twig_Error_Loader ( sprintf ( 'Unexpected template type "%s" found for template "%s".' , get_class ( $ template ) , $ name ) ) ; } if ( $ template instanceof TranslatableTemplateInterface ) { /** @var TranslatableTemplateInterface $template */ $ locale = $ this -> getCurrentLocale ( ) ; $ template -> setCurrentLocale ( $ locale ) ; } return $ template ; }
Find a template by it's name

@param  string             $name The name of the template to find
@return TemplateInterface
@throws \Twig_Error_Loader
Find a template by it s name