1

我一直在尝试使用 where 子句在相关的多对多表中获取记录,但没有成功。

我想重现以下声明:

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

遵循在谷歌、stackoverfow 和教义文档上找到的一些想法:

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

但结果并不理想。有什么帮助吗?谢谢..

4

0 回答 0