Hi guys,
I have a question about the way to retrieve data inside the controller. Supposing that i have two related tables, many to many:
Patient
PatientDoctor (Relation table)
Doctor
In my patient controller i am trying receive the related data from doctor model with this code:
$model=$this->loadModel($id);
foreach($model->patientdoctors as $doctor)
{
$id_doctor = $doctor['id_doctor'];
}
patientdoctors is the relation in Patient Model. Exist another method to receive the data from relation? Without use a foreach for get the data from array.