{"issue":{"state":"closed","pull_request":{"diff_url":null,"html_url":null,"patch_url":null},"user":{"avatar_url":"https://secure.gravatar.com/avatar/37d953b779140f975e85ff64b6459471?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"37d953b779140f975e85ff64b6459471","url":"https://api.github.com/users/Koc","login":"Koc","id":191082},"milestone":{"state":"open","open_issues":80,"url":"https://api.github.com/repos/symfony/symfony/milestones/6","due_on":null,"creator":{"avatar_url":"https://secure.gravatar.com/avatar/f1a2c5905e121d09feba5ad73898ffca?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"f1a2c5905e121d09feba5ad73898ffca","url":"https://api.github.com/users/fabpot","login":"fabpot","id":47313},"title":"2.1","description":"","number":6,"closed_issues":95,"created_at":"2011-05-03T13:52:15Z"},"assignee":null,"updated_at":"2011-11-07T20:00:43Z","labels":[{"name":"Templating","color":"FF5500","url":"https://api.github.com/repos/symfony/symfony/labels/Templating"}],"comments":6,"closed_at":"2011-11-07T19:57:12Z","url":"https://api.github.com/repos/symfony/symfony/issues/763","body":"Moved from trac.\r\n\r\nI'm working on theming bundle. Now template `MyBundle:Foo:bar.html.twig` can be located in:\r\n\r\n```\r\n1) app/Resources/design/frontend/theme1/views/MyBundle/Foo/bar.html.twig\r\n2) app/Resources/design/frontend/default/views/MyBundle/Foo/bar.html.twig\r\n3) app/Resources/views/MyBundle/Foo/bar.html.twig\r\n4) src/My/MyBundle/Resources/views/Foo/bar.html.twig\r\n```\r\n\r\nSo when error in template occured I should know - in what same template.\r\n\r\nFor example. Template:\r\n\r\n```jinja\r\n{{ 'create.post'|trans([], 'BlogBundle') a }}\r\n```\r\n\r\nException what I got:\r\n\r\n```\r\nUnexpected token \"name\" of value \"a\" (\"end of print statement\" expected) in \"DemoBundle:Demo:hello.html.twig\".\r\n```\r\n\r\nI've tryed to improve this by puting `/absolute/path/to/template` instead of template name to tokenizer. Diff 1:\r\n\r\n```diff\r\n--- a/code/vendors/twig/lib/Twig/Environment.php\r\n+++ b/code/vendors/twig/lib/Twig/Environment.php\r\n@@ -302,7 +302,8 @@\r\n                 eval('?>'.$this->compileSource($this->loader->getSource($name), $name));\r\n             } else {\r\n                 if (!file_exists($cache) || ($this->isAutoReload() && !$this->loader->isFresh($name, filemtime($cache)))) {\r\n-                    $this->writeCacheFile($cache, $this->compileSource($this->loader->getSource($name), $name));\r\n+                    $this->writeCacheFile($cache, $this->compileSource($this->loader->getSource($name), $this->loader->getCacheKey($name)));\r\n                 }\r\n \r\n                 require_once $cache;\r\n```\r\n\r\nBut got an error:\r\n\r\n```\r\nTwig_Error_Runtime: An exception has been thrown during the compilation of a template (\"Template name \"Z:home/dev/**/code/apps/app/Acme/DemoBundle/Resources/views/Demo/hello.html.twig\" is not valid (format is \"bundle:section:template.format.engine\").\") in \"Z:\\\\home\\\\dev\\\\**\\\\code\\\\apps\\\\app\\\\Acme\\\\DemoBundle\\/Resources\\/views\\/Demo\\/hello.html.twig\". in Z:\\home\\dev\\**\\code\\vendors\\twig\\lib\\Twig\\Environment.php on line 469\r\n```\r\n\r\nAnd there is Diff 2 (looks like hack), wich solve this exception:\r\n\r\n```diff\r\n--- a/code/vendors/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php\r\n+++ b/code/vendors/symfony/src/Symfony/Bundle/TwigBundle/Loader/FilesystemLoader.php\r\n@@ -86,6 +86,12 @@\r\n      */\r\n     protected function findTemplate($name)\r\n     {\r\n+        if (false !== (array_search($name, $this->cache))) {\r\n+            return $name;\r\n+        }\r\n+\r\n         $tpl = $this->parser->parse($name);\r\n \r\n         if (isset($this->cache[$key = $tpl->getSignature()])) {\r\n```\r\n\r\nAlso I've added `var_dump($name)` to `findTemplate` function:\r\n\r\n```\r\nstring 'FrameworkBundle:Exception:exception_full.html.twig' (length=50)\r\n\r\nstring 'FrameworkBundle:Exception:exception_full.html.twig' (length=50)\r\n\r\nstring 'FrameworkBundle:Exception:exception_full.html.twig' (length=50)\r\n\r\nstring 'FrameworkBundle:Exception:exception_full.html.twig' (length=50)\r\n\r\nstring 'Z:\\home\\dev\\**\\code\\vendors\\Symfony\\src\\Symfony\\Bundle\\FrameworkBundle/Resources/views/Exception/exception_full.html.twig' (length=122)\r\n```\r\n\r\nWhy 4 times putted template in format `Bundle:Section:name` and on 5th time putted absolute path?\r\n\r\nAnd I think that template name parser should store parsed templates instances. And maybe loader can store in cache path just by name, not by signature as now.\r\n","html_url":"https://github.com/symfony/symfony/issues/763","title":"[2.1] Save full path in rendereded twig templates (instead of bundle:section:name)","number":763,"id":848240,"created_at":"2011-05-04T11:44:45Z"},"action":"created","comment":{"user":{"avatar_url":"https://secure.gravatar.com/avatar/37d953b779140f975e85ff64b6459471?d=https://a248.e.akamai.net/assets.github.com%2Fimages%2Fgravatars%2Fgravatar-140.png","gravatar_id":"37d953b779140f975e85ff64b6459471","url":"https://api.github.com/users/Koc","login":"Koc","id":191082},"updated_at":"2011-11-07T20:00:43Z","url":"https://api.github.com/repos/symfony/symfony/issues/comments/2658760","body":"thank you.","id":2658760,"created_at":"2011-11-07T20:00:43Z"}}