更新时间:2023-11-09 22:46:58
这是因为您定义表单域的方式.
It's because of the way you have defined the form fields.
saveMany
的 Cake Book 指出数据应该在数字索引而不是文章键"中.http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array
The Cake Book for saveMany
states that data should be in "numerical index instead of article key".
http://book.cakephp.org/2.0/en/models/saving-your-data.html#model-savemany-array-data-null-array-options-array
因此,您的数据是一个数字索引,但在 CandidatesEmployer 键下,因此 saveMany
函数没有看到任何要保存的数据,因此没有错误.
So, your data is a numerical index but under the CandidatesEmployer key, so the saveMany
function isn't seeing any data to save, hence no errors.
将您的保存行更改为此应该可以:
Changing your save line to this should work:
$this->Candidate->CandidatesEmployer->saveMany($this->request->data['CandidatesEmployer'])
这种方式只传递数字索引.
This way only the numerical index is passed.