query builder 和 createquery


$em = $this->getEntityManager;
$qb = $em->createQueryBuilder;

$qb->select(array('a', 'c'))
   ->from('Sdz\BlogBundle\Entity\Article', 'a')
   ->leftJoin('a.comments', 'c');

$query = $qb->getQuery();
$results = $query->getResult();

return $results;

同时select 多个table

评论

热门帖子