1

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?

cheesemacfly
  • 11,622
  • 11
  • 53
  • 72
GergelyPolonkai
  • 6,230
  • 6
  • 35
  • 69
  • 1
    possible duplicate of [Resolve local file path from Twig template name](http://stackoverflow.com/questions/9330170/resolve-local-file-path-from-twig-template-name) – Tomasz Kowalczyk Mar 06 '13 at 17:31
  • Depending on your use case, you might find this useful as well: http://symfony.com/doc/current/cookbook/templating/namespaced_paths.html – Cerad Mar 07 '13 at 16:58

1 Answers1

3

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

"

Community
  • 1
  • 1
Tomasz Kowalczyk
  • 10,472
  • 6
  • 52
  • 68