title: Query Builder / DQL not working with INNER JOIN - Syntax Issue
body: <p>I know I have a syntax isse here however I cant figure it out. I'm trying to do a SELECT and INNER JOIN of 5 tables but Symfony is complaining about the Entities in the JOIN are used before being defined.</p>
  
  <p>Actual error is as follows: <code>[Semantical Error] line 0, col 121 near 'I ON C.id = ': Error: Identification Variable MySiteBundle:Items used in join path expression but was not defined before.</code></p>
  
  <p>Here is the PHP code.</p>
  
  <p><strong>Note:</strong> I have shortened this query to two columns, two tables, and one join to keep the question simple and show my point. The actual query is much longer and is producing the same error.</p>
  
  <pre><code>$em = $this-&gt;getDoctrine()-&gt;getEntityManager();
  $query = $em-&gt;createQuery(
      'select C.name as CName, I.id as IId
      FROM MySiteBundle:Categories C
      INNER JOIN MySiteBundle:Items I ON C.id = I.category_id');
  $result = $query-&gt;getResult();
  </code></pre>
  
  <hr>
  
  <p><strong>Update</strong></p>
  
  <p>As suggested I've done away with the DQL code and am using Query Builder code. I'm getting a very similiar error which says <code>'Categories c': Error: Class 'Categories' is not defined</code>. My QB code is below.</p>
  
  <pre><code>$em = $this-&gt;getDoctrine()-&gt;getEntityManager();
  $qb = $em-&gt;createQueryBuilder()
          -&gt;select('c.name, i.id, i.image, i.name, i.description, m.id, m.quantity, m.value, m.qty_received, m.custom_image, m.custom_name, m.custom_description, u.user1fname, u.user1lname, u.user2fname, u.user2lname')
          -&gt;from('Categories', 'c')
          -&gt;innerJoin('Items', 'i', 'ON', 'c.id = i.category_id')
          -&gt;innerJoin('MemberItems', 'm', 'ON', 'i.id = m.item_id')
          -&gt;innerJoin('User', 'u', 'ON', 'm.memberinfo_id = u.id')
          -&gt;where('u.id = ?', $slug)
          -&gt;orderBy('c.id', 'ASC')
          -&gt;getQuery();
  
  $memberItems = $qb-&gt;getResult();
  </code></pre>
  
  <p>Any suggestions?</p>