symfony关联连接多个表错误

I am trying to learn symfony and have problem with joining multiple tables however I cannt seems to connect morethan one table.

I pasted the code here: https://gist.github.com/anonymous/db8e96d0d6dd05ff7777

database schema: http://sqlfiddle.com/#!9/d3abc

Error:

[Syntax Error] line 0, col 243: Error: Expected =, <, <=, <>, >, >=, !=, got 'department' 

Any idea if iam missing anything?

note : First of all, your entities should start with a capital letter in your app...

in the doc, joins look like this :

when your entity User is aliased u

JOIN u.address address'

instead of

JOIN Test\JoinBundle\Entity\address address

In my code :

$query = $em->createQuery(
            "  SELECT d"
            . " FROM Main\MainBundle\Entity\Deal d "
            . " JOIN d.contact con"
            . " JOIN con.company c"
            . " WHERE c.id = ?1"
            . " ORDER BY c.created DESC"
            );
        $query->setParameter(1, $companyId);