Entity framework 未找到字段的映射

Entity framework 未找到字段的映射,entity-framework,symfony,orm,doctrine,mapping,Entity Framework,Symfony,Orm,Doctrine,Mapping,我必须去 class Patients { /** * @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patients") */ protected $contactaddress; } 还有一个 class ContactAddress { /** * @ORM\OneToOne(targetEntity="Patient

我必须去

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);
我明白了

当我尝试联系存储库时,我得到了结果

请帮忙;D
对不起,我的英语不好

您必须在ContactAddress实体中引用
患者
,而不是患者*s*

class Patients 
{
     /**
     * @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patient")
     */
    protected $contactaddress;
}
class Patients 
{
     /**
     * @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patient")
     */
    protected $contactaddress;
}