I'm trying to return an object in a model's view that goes an element and I can't figure out how to get my conditions out properly. Here's my controller:
function view($id = null) {
if (!$id) {
$this->Session->setFlash(__('Invalid admission', true));
$this->redirect(array('action' => 'index'));
}
$admission = $this->Admission->read(null, $id);
**$_patient_id = 2;**
$patientAdmissions = $this->Admission->getCurrentPatientAdmissions($_patient_id);
$this->set(compact('admission', 'patientAdmissions'));
}
This view function is in the admissions_controller and shows a specific admission with $id. I want to display a div with all of this patient's admissions in it. My getCurrentPatientAdmissions looks like this:
function getCurrentPatientAdmissions($_patient_id) {
$params = array(
'conditions' => array(
'Admission.patient_id' => $_patient_id,
),
);
return $this->find('all', $params);
}
Any ideas are much appreciated.