title: Lookup route in symfony 2
body: <p>I've defined a route in my app routing file:</p>
  
  <pre><code>RouteName:
      pattern:  /some/route
      defaults: { _controller: MyAppBundle:Controller:action }
  </code></pre>
  
  <p>In a controller I can use:</p>
  
  <pre><code>$this-&gt;get('router')-&gt;generate('RouteName');
  </code></pre>
  
  <p>How would I simply access that from a fresh class I create, for example a view class that doesn't extend anything:</p>
  
  <pre><code>namespace My\AppBundle\View;
  
  class ViewClass {
      public function uri()
      {
          return getTheRoute('RouteName');
      }
  }
  </code></pre>