title: Nested queries using symfony findBy method
body: <p>I have two entities <code>Category</code> and <code>Item</code>. I want to access all items under a particular category. <br/>
  Presently, I'm doing this as follows:</p>
  
  <ul>
  <li>Get entity corresponding to given category</li>
  <li>Get all Items by passing <code>category</code> selected in previous step as a parameter to <code>findBy</code> method.</li>
  </ul>
  
  <p>Here is my code:</p>
  
  <pre><code> public function indexAction($category)
    {
      $em = $this-&gt;getDoctrine()-&gt;getManager();
  
      $category = $em -&gt; getRepository('AppBundle:Category')
      -&gt; findOneBy(array(
        "name" =&gt; $category
      ));
  
      $entities = $em-&gt;getRepository('AppBundle:Item')
      -&gt;findBy(array(
        'category' =&gt; $category
      ));
  
      return array(
        'entities' =&gt; $entities,
        'title' =&gt; $category
      );
    }
  </code></pre>
  
  <p>Am I doing right? In this case I need two separate queries. Is there any efficient method?</p>