title: Join two entities in symfony2 using doctrine2
body: <p>There are two entities. <strong>Ticket</strong> and <strong>Device</strong>.</p>
  
  <p>In <strong>device orm</strong> there is</p>
  
  <pre><code>&lt;one-to-many target-entity="Ticket" mapped-by="Device" field="ticket"/&gt;
  &lt;many-to-one field="category" target-entity="Category"/&gt;
  </code></pre>
  
  <p>in <strong>ticket orm</strong></p>
  
  <pre><code>&lt;many-to-one field="device"  target-entity="Device"/&gt;
  </code></pre>
  
  <p>I want to implement a filter where the user can filter tickets by device's category. How can I do that? I tried with</p>
  
  <pre><code>$qb-&gt;select(array('t', 'd'))
          -&gt;from('MyBundle:Ticket', 't')
          -&gt;innerJoin('t.device', 'd')
          -&gt;where("t.category.name = 'Cashbox'");;
  </code></pre>
  
  <p>But this gives me an error</p>
  
  <pre><code>[Syntax Error] line 0, col 88: Error: Expected =, &lt;, &lt;=, &lt;&gt;, &gt;, &gt;=, !=, got '.'
  </code></pre>