How to debug when CakePHP Model::save() doesn't attempt an INSERT

后端 未结 8 1956
一个人的身影
一个人的身影 2021-01-03 23:22

I am having a bear of a time saving the simplest record from a model called ItemView:

if($this->save($this->data)) {
  echo \'worked\';
} else {
  echo         


        
8条回答
  •  执笔经年
    2021-01-03 23:52

    may be something like this

    $this->Model->set($this->data);
    
    $errors = $this->Model->validate();// or perhaps validationError(), please confirm
    
    if(!$errors) {
       $this->Model->save();
    }else{
       //show errors
       pr($errors);
    
    }
    

提交回复
热议问题