Problem saving data in tables without primaryKeys in cakephp
I would like to save internally in a HABTM relation table, i am running cakephp 1.3. Well in fact its save the data into table. but there is a error in the debug. I think its not the correct way.
Cause I have to set this model with primaryKey = NULL, so model.php broke in line 1379 when it read $fInfo = $this->_schema[$this->primaryKey];
my code is=
$vars = array('开发者_开发问答blogs_files'=>array('blog_id'=>$this->data['Blog']['id'],'file_id'=>$FILEID));
$this->blogs_files->primaryKey = NULL;
$this->blogs_files->save($vars);
have any idea? I have tried with SaveAll() but it worked worse.
even your HABTM tables should have a primary key! then it will be no problem to work with those tables
a simple int(10) won't hurt.
精彩评论