From 5ecf1cd1d1a45a299d5f61c6b96c2a50f70ffe9c Mon Sep 17 00:00:00 2001 From: Ryan Weaver Date: Thu, 7 Apr 2011 18:29:34 -0500 Subject: [PATCH] [FrameworkBundle] Taking advantage of the known type of $template to render meaningfull information about the template The $template variable is not type-hinted, but this is just because the `locate` method must follow the signature of the interface. According to the PHPDoc, the $template variable is in fact an instance of TemplateReferenceInterface, meaning we can call getPath() on it. The previous method of json_encode just returned two empty braces, at least in my experience. --- .../FrameworkBundle/Templating/Loader/TemplateLocator.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php index 461f9db97f..03795d4b71 100644 --- a/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php +++ b/src/Symfony/Bundle/FrameworkBundle/Templating/Loader/TemplateLocator.php @@ -60,7 +60,7 @@ class TemplateLocator implements FileLocatorInterface try { return $this->cache[$key] = $this->locator->locate($template->getPath(), $this->path); } catch (\InvalidArgumentException $e) { - throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', json_encode($template), $this->path), 0, $e); + throw new \InvalidArgumentException(sprintf('Unable to find template "%s" in "%s".', $template->getPath(), $this->path), 0, $e); } } }