title: generateUrl outside controller
body: <p>Is there a possibility to use generateUrl() method outside of controllers? </p>
  
  <p>I tried to use it in a custom repository class with <code>$this-&gt;get('router')</code>, but it didn't work. </p>
  
  <p><strong>update</strong></p>
  
  <p>I've found a temporary solution here:</p>
  
  <p><a href="http://www.phamviet.net/2012/12/09/symfony-2-inject-service-as-dependency-in-to-repository/" rel="noreferrer">http://www.phamviet.net/2012/12/09/symfony-2-inject-service-as-dependency-in-to-repository/</a></p>
  
  <p>I injected the whole service container into my repository, although it's "not recommended".</p>
  
  <p>But it works for now.</p>
  
  <p><strong>update2</strong></p>
  
  <p>Injecting router instead of the whole container is probably a better idea :)</p>