如何在多对多关系中使用doctrine2查询构建器设置where子句过滤器

时间:2013-06-30 15:52:55

标签: php doctrine-orm many-to-many query-builder

我一直试图用户doctrine2查询构建器没有成功,使用where子句获取相关多对多表中的记录。

我想重现以下声明:

SELECT [...] FROM Company
JOIN CompanyAddress ON CompanyAddress.CompanyId = Company.Id
JOIN Address ON Address.Id = CompanyAddress.AddressId
WHERE Address.State = ?

在google,stackoverfow和doctrine docs上发现了一些意识形态:

$qb = $this->_em->createQueryBuilder();
$qb->select('c')
    ->from('Company', 'c')
    ->where(':State MEMBER OF c.Address')
    ->setParameter('State', $arguments);

但结果不是理想的结果。有帮助吗?感谢..

0 个答案:

没有答案