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