Is there a way to convert Symfony filename notation Bundle:Controller:Filename to a real file path /var/www/whatever/src/Bundle/Resources/views/Controller/Filename?
- 1possible duplicate of Resolve local file path from Twig template nameTomasz Kowalczyk– Tomasz Kowalczyk2013-03-06 17:31:28 +00:00Commented Mar 6, 2013 at 17:31
- Depending on your use case, you might find this useful as well: symfony.com/doc/current/cookbook/templating/…Cerad– Cerad2013-03-07 16:58:09 +00:00Commented Mar 7, 2013 at 16:58
Add a comment |
1 Answer
Tak a look at this question: Resolve local file path from Twig template name . Accepted answer says:
"If you want to retrieve path from a controller you can use this code:
$parser = $this->container->get('templating.name_parser'); $locator = $this->container->get('templating.locator'); $path = $locator->locate($parser->parse('AcmeProjectBundle::home.html.twig')); For more info take a look at code of:
Symfony\Bundle\FrameworkBundle\Templating\TemplateNameParser::parse Symfony\Bundle\FrameworkBundle\Templating\Loader\TemplateLocator::locate "
1 Comment
GergelyPolonkai
I knew I saw this somewhere before... Only the word "resolve" didn't come to my mind. Thanks!