我必须实体
class Patients
{
/**
* @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patients")
*/
protected $contactaddress;
}
还有一个
class ContactAddress
{
/**
* @ORM\OneToOne(targetEntity="Patients", inversedBy="contactaddress")
* @ORM\JoinColumn(name="patient_id", referencedColumnName="id")
*/
protected $patient;
}
当我尝试执行此代码时
$em = $this->getDoctrine()->getEntityManager();
$product = $em->getRepository('SurgeryPatientBundle:Patients')->find($id);
我明白了
No mapping found for field 'patients' on class 'Surgery\PatientBundle\Entity\ContactAddress'.
当我尝试访问联系人存储库时,我得到了结果
请帮助;D对不起我的英语