I have 2 tables. One has 2 primary keys i.e. composite key. And same is foreign key in another table. Now Doctrine always return object for foreign key not value. In the case of single primary key I have somehow managed to get it but in case of composite I am not sure how to do it.
Code in case of single primary key as follows:
$patient = $this->entity->getPatient();
$patient_vars = $patient->toString(); // Inernal function to get private variables
$em = $this->doctrine->getManager();
$metaLabTest = $em->getClassMetadata(get_class($patient));
$identifierLabTest = $metaLabTest->getIdentifier($patient);
$metaPatient = $em->getClassMetadata(get_class($patient_vars[$identifierLabTest[0]]));
$identifierPatient = $metaPatient->getIdentifier();
$getFn = "get".$identifierPatient[0];
return $patient_vars[$identifierLabTest[0]]->$getFn();
Any suggestion for above will appreciated as well as I am pretty new to doctrine and symfony.
Thanks in advance.