I have to Entities
class Patients
{
/**
* @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patients")
*/
protected $contactaddress;
}
And another
class ContactAddress
{
/**
* @ORM\OneToOne(targetEntity="Patients", inversedBy="contactaddress")
* @ORM\JoinColumn(name="patient_id", referencedColumnName="id")
*/
protected $patient;
}
When I try execute this code
$em = $this->getDoctrine()->getEntityManager();
$product = $em->getRepository('SurgeryPatientBundle:Patients')->find($id);
I get
No mapping found for field 'patients' on class 'Surgery\PatientBundle\Entity\ContactAddress'.
When i tried get to Contact repository I get result
Please Help ;D Sorry for my English
You must refer to patient
instead of patient*s* in ContactAddress entity.
class Patients
{
/**
* @ORM\OneToOne(targetEntity="ContactAddress", mappedBy="patient")
*/
protected $contactaddress;
}
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.