cakephp - 如何修复“_existsIn' => '此值不存在'” Cakephp
问题描述
保存功能仅在我删除 company_id 时有效,但当我将 company_id 带回时,调试显示“_existsIn' => '此值不存在'”
public function createForm(){
$user = $this->Auth->user();
$company_id = $user['company_id'];
$form_title = $_POST['form_title'];
$total_score = $_POST['total_score'];
$form = $this->FieldCoachingForms->newEntity();
if ($this->request->is('post')) {
$form->title = $form_title;
$form->deleted = 0;
$form->company_id = $company_id;
if($this->FieldCoachingForms->save($form)){
$this->Flash->success(__('Field Coaching Form has been saved!'));
}else{
$this->Flash->error(__('Something Went Wrong'));
debug($form->errors());
}
}
exit();
}
解决方案
您可能在of中有一条existsIn
规则,并且不存在具有 ID 的公司。buildRules
FieldCoachingModel
$company_id
推荐阅读
- angular - (用户管理系统) - web app的第一页是登录页面
- python - 在 Python 中从数组中提取 JSON ID
- jquery - 如何在 Angular 2+ 中设置免费的 jqGrid
- amazon-web-services - AWS ELB 中“客户端 TLS 协商错误”激增的原因可能是什么?
- apache-spark - 如何在没有 Databricks 但在 Windows 10 上使用 wasbs 从带有 Apache Spark 的 Azure Blob 读取文件?
- aws-ssm - 解析从 aws 系统管理器 send_command 传递的 args
- pytorch - GTX 1080 ti、Tesla k80、Tesla v100 上相同 pytorch 型号的不同内存分配
- r - R) Counts.csv.gz 文件到 Seurat 对象
- javascript - 如何防止我的表单被提交?
- django - 在 Django 中从用户到用户发送简单的消息