我从各种来源构建了一个数据数组,然后想将它保存到数据库中的一个表中。调试数组时所有字段都是正确的:
array(
'KmLibrary' => array(
(int) 0 => array(
'km_file_id' => (int) 5910,
'title' => 'Guide Tax Season 2012 Afrikaans',
'author' => 'SARS',
'book_number' => '213',
'isbn' => '23523626235425',
'category' => 'Blue',
'keywords' => 'Some keywords'
),
(int) 1 => array(
'km_file_id' => (int) 5911,
'title' => 'Tax season 2012 insert',
'author' => 'SARS',
'book_number' => '235',
'isbn' => '329062806306',
'category' => 'Red',
'keywords' => 'Nothing to report'
),
(int) 2 => array(
'km_file_id' => (int) 5912,
'title' => 'Source Codes',
'author' => 'SARS',
'book_number' => '462',
'isbn' => '23562362354',
'category' => 'This',
'keywords' => 'Boobs'
)
)
)
但是,当我使用命令$this->KmLibrary->saveAll($data);
OR$this->KmLibrary->save($data);
时,它只是将一条空记录添加到数据库中。
有谁知道我在这里做错了什么?