[英]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.