是否可以使用ORM QueryBuilder为加入非关联实体生成查询,如下所示:
$query = $em->createQuery('SELECT u FROM User u JOIN Blacklist b WITH u.email = b.email');
答案 0 :(得分:8)
我不明白为什么不......不管怎样,QueryBuilder只能转换为DQL。
http://doctrine-orm.readthedocs.org/en/latest/reference/query-builder.html
$qb = $em->createQueryBuilder()
->select('u')
->from('User', 'u')
->join('Blacklist', 'b', 'WITH', 'u.email = b.email')
;