Reputation: 6431
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
?
Upvotes: 1
Views: 597
Reputation: 10467
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
"
Upvotes: 3