我正在使用cakephp 2.0。使用delete All功能。我没有从DB中删除任何错误。
public function admin_deleteTutorial($tutorial_id = null){
if($tutorial_id > 0){
// $this->Tutorial->delete($tutorial_id);
$condition = array('TutorialDiscussion.tutorial_id' => $tutorial_id );
$this->TutorialDiscussion->deleteAll($condition);
$this->Session->write('message','Tutorial details deleted successfully.');
$this->redirect('/admin/tutorials/index/');
}
}
** Is it required to first find out list of all id's from TutorialDiscussion having tutoril id this $tutorial. or it will delete all itself.** Though records are deleted from TUtorials so I have commented that.