Skip to content

Instantly share code, notes, and snippets.

@iaditya
Created April 24, 2017 18:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iaditya/6ae85016af72929ec12f7f855f6674a2 to your computer and use it in GitHub Desktop.
Save iaditya/6ae85016af72929ec12f7f855f6674a2 to your computer and use it in GitHub Desktop.
// primary caregiver
if($patient->dirty('primary_contact_email') || $patient->dirty('primary_contact_phone1')) {
if ($new_caregiver_id1) {
// Found Existing user
// send notification
// create mapper Entity
if($caregiver1) {
$caregiver1->caregiver_patient_id = $new_caregiver_id1;
$this->Patients->Caregivers->save($caregiver1);
} else {
$caregiver1 = $this->Patients->Caregivers->newEntity();
$caregiver1->patient_id = $patient->id;
$caregiver1->caregiver_patient_id = $new_caregiver_id1;
$caregiver1->caregiver_type = 0;
//$caregiver1->active = 0;
// saving caregiver association.
$this->Patients->Caregivers->save($caregiver1);
}
} else {
if ($this->emailFound($this->request->data['primary_contact_email'])) {
// Found Existing user
//send notification
// create mapper Entity
} else {
//add new user/caregiver
// create mapper Entity
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment