我无法找出我的函数出错的地方,我想知道是否有任何方法让我找出函数在使用 net beans 或在执行函数时中断的地方。
如果您想查看该功能,那么这里是它的副本:
public function archive($id = null) {
if ($this->request->is('post')) {
$event = $this->Event->read(null, $id);
$archive['Archive'] = $event['Event'];
$archive['Archive']['archiveID'] = $event['Event']['eventID'];
unset($archive['Archive']['archiveID']);
$this->loadModel('Archive');
$this->Archive->create();
if ($this->Archive->save($archive)) {
// $this->Archive->invalidFields();
$this->redirect(array('action' => 'eventmanage'));
$this->Session->setFlash(__('The event has been archived'));
// $this->Event->delete($id);
} else {
$this->redirect(array('action' => 'eventmanage'));
$this->Session->setFlash(__('The event could not be archived, Please, contact the administrator.'));
}
}
}
so far i have tried using the `$errors = $this->Archive->validationErrors;` function but all i receive back is the word 'array'
更新
我已将事件保存为存档,但它不会发送消息$this->Session->setFlash(__('The event has been archived'));
并且它不会重定向回 eventmanage,它会创建一个指向 /Controller/Action/id 的新链接,例如 /events/archive/14 。
谢谢