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?

2

1 Answer 1

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 

"

Sign up to request clarification or add additional context in comments.

1 Comment

I knew I saw this somewhere before... Only the word "resolve" didn't come to my mind. Thanks!

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.