"accessing files relative to bundle in symfony2" Answer’s


As a matter of fact, there is a service you could use for this, the kernel ($this->get('kernel')). It has a method called locateResource().

For example:

$kernel = $container->getService('kernel');
$path = $kernel->locateResource('@AdmeDemoBundle/path/to/file/Foo.txt');
Wednesday, March 31, 2021
answered 11 Months ago
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :