title: Doctrine querybuilder multiple join
body: <p>I've an error while joining my tables like this :</p>
  
  <pre><code>$queryBuilder = $conn-&gt;createQueryBuilder();
  $queryBuilder-&gt;select('*')
               -&gt;from('table1','t1')
               -&gt;innerJoin('t1','table2','t2', 't1.id = t2.id' )
               -&gt;innerJoin('t2','table3','t3', 't2.id = t3.id' )
               ;
  $queryBuilder-&gt;getSQL();
  </code></pre>
  
  <p>Fatal error: Uncaught exception 'Doctrine\DBAL\Query\QueryException' with message 'The given alias 't2' is not part of any FROM clause table. The currently registered FROM-clause aliases are: t1. Join clauses are bound to from clauses to provide support for mixing of multiple from and join clauses.</p>
  
  <p>Seems the builder only check join linked with the from, not the join linked with other joins, in getSQLForSelect :</p>
  
  <pre><code>    if (isset($this-&gt;sqlParts['join'][$from['alias']])) {
                  foreach ($this-&gt;sqlParts['join'][$from['alias']] as $join) {
                          $fromClause .= ' ' . strtoupper($join['joinType'])
                                       . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias']
                                       . ' ON ' . ((string) $join['joinCondition']);
                  }
              }
  </code></pre>
  
  <p>Changing this seems to work but it's dirty (and bring others pbs)</p>
  
  <pre><code>        if (isset($this-&gt;sqlParts['join'])) {
              foreach ($this-&gt;sqlParts['join'] as $joins) {
                  foreach ($joins as $join) {
                      $fromClause .= ' ' . strtoupper($join['joinType'])
                                   . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias']
                                   . ' ON ' . ((string) $join['joinCondition']);
                  }
              }
          }
  </code></pre>