title: How can i access repository functions in twig template in symfony2
body: <p>I have the <code>class categroies</code> and <code>class Products</code>.</p>
  
  <p>In my repository i have function</p>
  
  <p><code>getProducts($categoryid,$location)</code></p>
  
  <p>I need to loop in twig template like this</p>
  
  <pre><code> {% for category in categories %}
      --{{ category.name }}--
        {% for product in getProducts(category.id,location) %}
       --{{ product.name }}--
      {% endfor %}
   {% endfor %}
  </code></pre>
  
  <p>or is there any better way for that</p>