2017-04-06 71 views
0

我有一些查询,我需要在选择块选择ID关系实体,我怎么能没有一些连接,就像在SQL?在例子中,我添加了左连接,但我想明白这可能没有连接像lsc.serviceCompany.id或如何?查询生成器选择实体关系ID

 $qb 
     ->select(' 
      ser_com.id as serviceCompanyId 
     ') 
     ->from('AppBundle:LocationServiceCompany', 'lsc') 
     ->leftJoin('lsc.serviceCompany', 'ser_com') 
     ->where('lsc.serviceCompany = :sc') 
     ->setParameter('sc', $serviceCompany); 
+0

的可能的复制[如何获得没有doctrine2加入一个id?](http://stackoverflow.com/questions/3913150/how-to-get- AN-ID-没有联接功能于doctrine2) – LBA

回答