登録アクションがデータを保存しようとすると、何も起こらず、ユーザーは同じページに戻ります
'$this->Participant->create()' を実行しているときに見つけたいくつかのデバッグの後、新しい ID は返されません
if ($this->request->is('post') || $this->request->is('put')) {
if (!isset($this->data['Participant']['typeSel'])) {
$regType = $this->data['Participant']['type'];
// for pilots and visitors, copy the name/email from TeamMember to Participant
if ($regType == 'pilot' || $regType == 'visitor') {
$this->request->data['Participant']['name'] =
ucwords(strtolower($this->request->data['TeamMember'][0]['first_name'])) . ' '
. ucwords(strtolower($this->request->data['TeamMember'][0]['family_name']));
$this->request->data['Participant']['email'] = $this->request->data['TeamMember'][0]['email'];
}
// mark valid inside the team (if not joining)
if ($regType != 'jointeam') {
foreach ($this->request->data['TeamMember'] as & $teamMember) {
$teamMember['validate_inteam'] = 'yes';
if ($regType == 'visitor') {
$teamMember['free_entrance'] = 'yes';
$teamMember['num_tables'] = 0;
}
}
$numTeamMembers = count($this->data['TeamMember']);
}
// set password
$this->request->data['Participant']['password'] =
Security::hash($this->data['Participant']['password1'], null, true);
// perform registration itself
if ($regType == 'jointeam') {
$this->TeamMember->create($this->request->data);
if ($this->TeamMember->save($this->request->data)) {
$this->Session->setFlash('Your registration was recorded. An email was dispatched to the team coordinator for approval.');
$this->Mail->sendTeamValidationEmail(
$this->Participant->findById($this->data['TeamMember']['participant_id']));
$this->redirect(array(
'controller' => 'pages',
'action' => 'welcome'));
}
else {
$this->Session->setFlash('Your registration could not be completed. Please try again.');
}
}
else {
$this->Participant->create(); // $this->Participant->id remains empty
if ($this->Participant->saveAll($this->request->data)) {
$this->Session->setFlash('Your registration was recorded. You will receive an email with further details during the next 24 hours.');
$this->Mail->sendConfirmEmail($this->Participant->findById($this->Participant->id));
$this->redirect(array(
'controller' => 'pages',
'action' => 'welcome'));
}
else {
$this->Session->setFlash('Your registration could not be completed. Please try again.');
}
}
}
}
IDを追加する作成機能を取得するにはどうすればよいですか。他のコントローラーでログインしてデータ取得できるのでDBは問題なさそうです