Hie guys, im seeking your help. An applicant applies for a place and the details are saved in the applicants table and is given a default status of waiting. The administrator accepts applicants form waiting to either accepted or denied. When a student is accepted his details should automatically be saved to the students table. Applicants table and students have 26 fields in common and the national id is common and unique in both tables but it is not a primary key in either table.
a) Is it possible to approve applicants to students and post their details to students details in this instance?
b) How do i link these two tables? Is it possible to link tables with a unique key that is not a primary key in cakephp?
c) How can i transfer the details from applicants details to students details?
For posting data from applicants details to students i have tried this in my controller but i am getting fatal error. I have only tried two fields for testing.
if($this->request->data['submit']=='Approve') {
$this->ApplicantsDetail->StudentDetail->set(array(
'reg_number' => $regnumber,
'code'=>$code
));
}
For approving applicants to students i used the following code
if($this->request->data['submit']=='Approve') {
$code=$this->request->data['ApplicantsDetail']['code'];
for($k=0;$k<sizeof($this->request->data['ApplicantsDetail']['id']);$k++){
$id=$this->request->data['ApplicantsDetail']['id'];
$newcode=$this->ApplicantsDetail->ProgrammeChoice->find('list', array(
'fields'=>array('applicants_detail_id','choice','programme_code'),
'conditions'=>array('ProgrammeChoice.programme_code'=>$code,'ProgrammeChoice.choice'=>1)
));
$tau1 = array('ApplicantsDetail.statu_id' => '1');
}
}