Symfony2
. In a controller
, I would like to define a path to the Resources/public/pdf
directory of a bundle of mine.
If I use __DIR__
, I get the path to the Controller directory of my bundle; if $this->get('kernel')->getRootDir()
, the path to the App directory. Either way I am not able to move back to the upper directory.
How do I do?
ps. something like $this->get('kernel')->getRootDir().'/../src/
renders .../app/../src/
.
EDIT I got what i need by a very simple minded and ugly fix:
$path001 = $this->get('kernel')->getRootDir().'/';
$path002 = explode('/', $path001);
$path003 = array_pop($path002);
$path003bis = array_pop($path002);
$path004 = implode("/", $path002);
$path_pdf = $path004.'/src/Mario/<MyBundle>/Bundle/Resources/public/pdf';
Is there a better way?