0
CakePHP 프레임 워크로 레코드를 업데이트하려고하는데, 업데이트 할 수 없다는 오류가 나타납니다. 그러나 오류의 출처를 찾을 수 없습니다.Cakephp가 모델을 업데이트하지 않습니다.
컨트롤러/InvoicesController.php
if ($this->request->is(array('post', 'put'))) {
$this->Invoice->id = $id;
if ($this->Invoice->save($this->request->data)) {
$this->Session->setFlash(__('Invoice updated'), 'flash-success');
} else {
$this->Session->setFlash(__('Please try again'), 'flash-error');
debug($this->validationErrors, true);
pr($this->request->data);
}
}
디버그이 결과 :
/app/Controller/InvoicesController.php (line 73)
null
그리고 이것이
이는 경우 문이 컨트롤러에 실패 장소입니다 저장할 때 CakePHP에서 오는 데이터 :
Array
(
[Invoice] => Array
(
[date] => Array
(
[day] => 05
[month] => 01
[year] => 2015
)
[period] => 14
[notes] =>
)
)
왜 CakePHP는 내 기록을 업데이트 할 수 없습니까?
추가하고 데이터를 인쇄 할 수있는 ID 값을 포함해야합니다 당신이 구하려고하는거야? 즉 save() 명령을 수행하기 직전에 $ id 및 $ this-> Invoice가 무엇인지 보여줍니다. – Crembo