[英]No mapping found for field
我必须去实体
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对不起,我的英语
你必须参考patient
的,而不是在ContactAddress实体病人* S *。
class Patients
{
/**
* @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patient")
*/
protected $contactaddress;
}
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.