首先,我要非常感谢 Doctrine 开发人员,你们太棒了!我的问题如下:
我有三张桌子:
person (id, name, isActive)
email (id, address, isActive)
personEmailRel(id, personId, emaiId, isActive)
我想按人获取电子邮件列表:
/**
* Unidirectional - Many persons have many emails
*
* @ManyToMany(targetEntity="Address_Model_Email")
* @JoinTable(name="personEmailRel",
* joinColumns={@JoinColumn(name="personId", referencedColumnName="id")},
* inverseJoinColumns={@JoinColumn(name="emailId", referencedColumnName="id")}
* )
*/
private $_emails;
public function __construct()
{
$this->_emails = new Collections\ArrayCollection();
}
public function getEmails()
{
return $this->_emails;
}
工作正常。但问题是我还想在join子句中设置添加条件isActive=1。如何在 Doctrine2 中解决这个问题?谢谢。